Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

It's probably an obvious one but since I'm new to arcpy I'd appreciate any help.

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'

I'd be grateful for any suggestions!

Thanks,

Magda

share|improve this question
add comment

1 Answer

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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