<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to determine if an image file is georeferenced in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543165#M14699</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rick,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If am image has been geo-referenced then it should return an extent. You could have a scenario where an image has a world file but no projection information but it would return an extent. So knowing that, the VBA code below demonstrates how to test for this. I leave it up to you to wrap it up into a loop. The limitation with this example is that it is assumed that the raster is not in a geographical coordinate system.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public Sub Test() &amp;nbsp;&amp;nbsp;&amp;nbsp; ' This code expects the first layer in the TOC to be a raster &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get map &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMXD As IMxDocument &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMXD = ThisDocument &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMXD.FocusMap &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get raster &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer As ILayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pLayer = pMap.Layer(0) &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRasterLayer&amp;nbsp; As IRasterLayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRasterLayer = pLayer &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get extent &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pGeoDataset As IGeoDataset &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pGeoDataset = pRasterLayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnv As IEnvelope &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pEnv = pGeoDataset.Extent &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Test minimum value, assumes rasters are not in decimal degrees &amp;nbsp;&amp;nbsp;&amp;nbsp; If pEnv.XMin = -0.5 Then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print "This raster has no extent so can't be geo-referenced!" &amp;nbsp;&amp;nbsp;&amp;nbsp; Else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print "This raster is geo-referenced!" &amp;nbsp;&amp;nbsp;&amp;nbsp; End If End Sub&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2013 21:21:05 GMT</pubDate>
    <dc:creator>DuncanHornby</dc:creator>
    <dc:date>2013-10-04T21:21:05Z</dc:date>
    <item>
      <title>How to determine if an image file is georeferenced</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543164#M14698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a task to scan a folder for georeferenced images. There might be a lot of images, some quite large, and some not georeferenced. The spatial information can also be either embedded or in a world file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there anything available in the runtime that can tell me if "C:\someFolder\file.x" is georeferenced.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Rick Cote&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thalse Systems&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Sep 2013 20:43:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543164#M14698</guid>
      <dc:creator>RickCote</dc:creator>
      <dc:date>2013-09-24T20:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine if an image file is georeferenced</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543165#M14699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Rick,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If am image has been geo-referenced then it should return an extent. You could have a scenario where an image has a world file but no projection information but it would return an extent. So knowing that, the VBA code below demonstrates how to test for this. I leave it up to you to wrap it up into a loop. The limitation with this example is that it is assumed that the raster is not in a geographical coordinate system.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Public Sub Test() &amp;nbsp;&amp;nbsp;&amp;nbsp; ' This code expects the first layer in the TOC to be a raster &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get map &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMXD As IMxDocument &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMXD = ThisDocument &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pMap As IMap &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pMap = pMXD.FocusMap &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get raster &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pLayer As ILayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pLayer = pMap.Layer(0) &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pRasterLayer&amp;nbsp; As IRasterLayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pRasterLayer = pLayer &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Get extent &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pGeoDataset As IGeoDataset &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pGeoDataset = pRasterLayer &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pEnv As IEnvelope &amp;nbsp;&amp;nbsp;&amp;nbsp; Set pEnv = pGeoDataset.Extent &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ' Test minimum value, assumes rasters are not in decimal degrees &amp;nbsp;&amp;nbsp;&amp;nbsp; If pEnv.XMin = -0.5 Then &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print "This raster has no extent so can't be geo-referenced!" &amp;nbsp;&amp;nbsp;&amp;nbsp; Else &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Debug.Print "This raster is geo-referenced!" &amp;nbsp;&amp;nbsp;&amp;nbsp; End If End Sub&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 21:21:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543165#M14699</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2013-10-04T21:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine if an image file is georeferenced</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543166#M14700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It's a performance issue. This is processing I'd have to do if I wanted to load an image, but I don't want to load it just to find out it isn't georeferenced and therefore don't need it anyway. In this application there could be a lot of non-georeferenced images.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The solution I have right now is to scan the image for an indicator string. Working so far but it's bound to fail sometime. After that I may try using the GDAL libraries.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Rick&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Oct 2013 12:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-determine-if-an-image-file-is-georeferenced/m-p/543166#M14700</guid>
      <dc:creator>RickCote</dc:creator>
      <dc:date>2013-10-07T12:09:29Z</dc:date>
    </item>
  </channel>
</rss>

