<?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: testing for raster in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35235#M1237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Caleb1987&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use the list rasters function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rasterList = arcpy.ListRasters()
for raster in rasterList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:22:20 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-12-10T21:22:20Z</dc:date>
    <item>
      <title>testing for raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35234#M1236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: dhealey&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In 10.1, I'm using&amp;nbsp; FC_List = arcpy.ListFeatureClasses() to capture a list of fc's names,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; but some of those are also raster.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now, I'm not seeing that in the doc &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000018000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//018v00000018000000&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; However, to humor me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using Arcpy, what test can I use to distinguish fc from raster?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As in perhaps...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for name in FC_List:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; if name.ObjectType_for_example == "raster":&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; process_raster(name)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; else:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; process_fc(name)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2012 01:13:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35234#M1236</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-10-30T01:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: testing for raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35235#M1237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: Caleb1987&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use the list rasters function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
rasterList = arcpy.ListRasters()
for raster in rasterList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:22:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35235#M1237</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T21:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: testing for raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35236#M1238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.workspace = r'C:\temp'

rasterList = arcpy.ListRasters()
for raster in rasterList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print raster
&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something with these

fc_list = arcpy.ListFeatureClasses()
for fc in fc_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print fc
&amp;nbsp;&amp;nbsp;&amp;nbsp; # do something with these
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:22:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35236#M1238</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-10T21:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: testing for raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35237#M1239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: curtvprice&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Using Arcpy, what test can I use to distinguish fc from raster?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That list function should be only return feature classes. ListDatasets gives you both flavors. But to answer your question, the properties of an object are determined using the Describe function. You're looking for the "datasetType" property:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Dataset_properties/000v0000002m000000/"&gt;Dataset properties&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Describe(dataset).datasetType in ["RasterDataset","RasterBand"]&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Oct 2012 16:45:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35237#M1239</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-10-30T16:45:00Z</dc:date>
    </item>
    <item>
      <title>Re: testing for raster</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35238#M1240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Original User: dhealey&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;That list function should be only return feature classes. ListDatasets gives you both flavors. But to answer your question, the properties of an object are determined using the Describe function. You're looking for the "datasetType" property:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Describe(dataset).datasetType in ["RasterDataset","RasterBand"]&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;That list function should be only return feature classes.&amp;gt;&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, that is what the docs say, but I do not have time to wrestle with tech support.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I saw the &amp;lt;&amp;lt;arcpy.ListRasters&amp;gt;&amp;gt; already and would have used it if needed, thx.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;&amp;lt;arcpy.Describe(fc).datasetType&amp;gt;&amp;gt; works great and will probably use is more often.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you both of you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 06 Nov 2012 17:16:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/testing-for-raster/m-p/35238#M1240</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2012-11-06T17:16:53Z</dc:date>
    </item>
  </channel>
</rss>

