3

I'm trying to develop an arcpy script which will eventually loop through number of rasters and feature classes stored in file geodatabase. I'd like to export spatial reference for these attributes along with their name to csv. I managed to do that for raster datasets, however I'm struggling with feature classes.

All rasters are stored directly in geodatabase so I have no problem with referencing these. All feature classess are stored within 3 feature datasets. In order to reference these FCs I set env.workspace pointing to relevant Feature Dataset, which works fine. I'd like to find the way to reference all of my Fcs at once, something like:

arcpy.env.workspace="...\Name.gdb"
fcList = arcpy.ListFeatureClasses("*", "polygon", ***InFeatureDatasets***)
outFilePTH = r'...\output.csv'
6

You could get a list of the featuredatasets using the ListDatasets function, then loop through that list to get at the featureclasses within each featuredataset. From the docs:

datasetList = arcpy.ListDatasets("C*", "Feature")

for dataset in datasetList:
    print dataset

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.