<?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 Arcpy 10.1 ListFeatureClasses returns Raster Datasets in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73407#M6022</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to loop through all the feature classes in an SDE geodatabase and get their name and feature count.&amp;nbsp; When I attempt to get the feature count of each feature class I run into an error because in my list there are raster datasets.&amp;nbsp; Why are there raster datasets in my resulting list from arcpy.ListFeatureClasses()? I pasted the code but it doesn't make sense to me why raster datasets are included in List&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;FeatureClasses&lt;/SPAN&gt;&lt;SPAN&gt;?&amp;nbsp; What am I missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env&amp;nbsp; env.workspace = r'Database Connections\MySDEgeodatabase.sde'&amp;nbsp; fcList = arcpy.ListFeatureClasses()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looped through fcList using this code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for fc in fcList: &amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(f) &amp;nbsp;&amp;nbsp;&amp;nbsp; print '{0}&amp;nbsp; {1}'.format(desc.name, desc.dataType)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is where I realized the list contained raster datasets with dataTypes of "RasterDataset"? I want to avoid having to use arcpy.Describe() to filter to to get feature classes because there are hundreds of feature classes in the SDE geodatabase and it slows it down a ton.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jan 2014 18:05:20 GMT</pubDate>
    <dc:creator>BenjaminHillam</dc:creator>
    <dc:date>2014-01-16T18:05:20Z</dc:date>
    <item>
      <title>Arcpy 10.1 ListFeatureClasses returns Raster Datasets</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73407#M6022</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to loop through all the feature classes in an SDE geodatabase and get their name and feature count.&amp;nbsp; When I attempt to get the feature count of each feature class I run into an error because in my list there are raster datasets.&amp;nbsp; Why are there raster datasets in my resulting list from arcpy.ListFeatureClasses()? I pasted the code but it doesn't make sense to me why raster datasets are included in List&lt;/SPAN&gt;&lt;SPAN style="text-decoration:underline;"&gt;FeatureClasses&lt;/SPAN&gt;&lt;SPAN&gt;?&amp;nbsp; What am I missing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;import arcpy from arcpy import env&amp;nbsp; env.workspace = r'Database Connections\MySDEgeodatabase.sde'&amp;nbsp; fcList = arcpy.ListFeatureClasses()&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looped through fcList using this code&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for fc in fcList: &amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(f) &amp;nbsp;&amp;nbsp;&amp;nbsp; print '{0}&amp;nbsp; {1}'.format(desc.name, desc.dataType)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is where I realized the list contained raster datasets with dataTypes of "RasterDataset"? I want to avoid having to use arcpy.Describe() to filter to to get feature classes because there are hundreds of feature classes in the SDE geodatabase and it slows it down a ton.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jan 2014 18:05:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73407#M6022</guid>
      <dc:creator>BenjaminHillam</dc:creator>
      <dc:date>2014-01-16T18:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy 10.1 ListFeatureClasses returns Raster Datasets</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73408#M6023</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This only returns/prints info on the FeatureClass for me but it is slow:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fcList = arcpy.ListFeatureClasses()
for fc in fcList:
&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp; print '{0}&amp;nbsp; {1}'.format(desc.name, desc.dataType)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This zips right through very quickly and returns the same list of only FeatureClasses:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;fcList = arcpy.ListFeatureClasses()
for fc in fcList:
&amp;nbsp;&amp;nbsp; print fc&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:51:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73408#M6023</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2021-12-10T22:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy 10.1 ListFeatureClasses returns Raster Datasets</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73409#M6024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Yeah, maybe there is something wrong with the sde geodatabase or the actually raster layer that is causing the "arcpy.ListFeatureClass" to return raster datasats.&amp;nbsp; I had to work around it by describing each item the feature class list and filter out any raster datasets.&amp;nbsp; It works but takes a really long time.&amp;nbsp; Still baffles me that ListFeatureClasses would return raster datasets.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 15:16:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73409#M6024</guid>
      <dc:creator>BenjaminHillam</dc:creator>
      <dc:date>2014-01-20T15:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy 10.1 ListFeatureClasses returns Raster Datasets</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73410#M6025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There are filters based on which you can restrict what type of Dataset you want to see, Feature dataset Vs Raster dataset. I believe thats what you want to accomplish?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;datasetList = arcpy.ListDatasets("*", "Feature")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for dataset in datasetList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print dataset&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;fcList = arcpy.ListFeatureClasses("*","",dataset)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for fc in fcList:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;print fc&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Similarly&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;datasetList = arcpy.ListDatasets("*", "Raster")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;should give you only raster datasets.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jan 2014 17:03:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73410#M6025</guid>
      <dc:creator>SachinKanaujia</dc:creator>
      <dc:date>2014-01-20T17:03:21Z</dc:date>
    </item>
    <item>
      <title>Re: Arcpy 10.1 ListFeatureClasses returns Raster Datasets</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73411#M6026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sachin, Thanks for the filtering tip that helps, but it still doesn't make sense to me that arcpy.ListFeatureClasses() would return anything other than a Feature Class. It must be something funky with the SDE or specific datasets I'm listing. I ended up using your filtering tips and arcpy.Describe to work around it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jan 2014 17:29:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-10-1-listfeatureclasses-returns-raster/m-p/73411#M6026</guid>
      <dc:creator>BenjaminHillam</dc:creator>
      <dc:date>2014-01-30T17:29:55Z</dc:date>
    </item>
  </channel>
</rss>

