Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Arcpy 10.1 ListFeatureClasses returns Raster Datasets

$
0
0
I am trying to loop through all the feature classes in an SDE geodatabase and get their name and feature count. 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. 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 ListFeatureClasses? What am I missing?

Code:

import arcpy
from arcpy import env

env.workspace = r'Database Connections\MySDEgeodatabase.sde'

fcList = arcpy.ListFeatureClasses()

I looped through fcList using this code

Code:

for fc in fcList:
    desc = arcpy.Describe(f)
    print '{0}  {1}'.format(desc.name, desc.dataType)

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.

Viewing all articles
Browse latest Browse all 2485