Created
October 6, 2014 17:04
-
-
Save knu2xs/810e0efae63c78d9b991 to your computer and use it in GitHub Desktop.
Demonstration script for arcpy.da.walk
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # import modules | |
| import os | |
| import arcpy | |
| # variables | |
| gdb = r'C:\Student\PYTH_20141006\PYTH_dataStudent\IAGL_Lincoln\Lincoln.gdb' | |
| # walk recursively from top level in geodatabase | |
| for dir, dirs, files in arcpy.da.Walk(gdb): | |
| # for every file in this directory or feature dataset | |
| for file in files: | |
| # combine the current directory path and file name to create full path | |
| path = os.path.join(dir, file) | |
| # create describe object for current data object's properties | |
| desc = arcpy.Describe(path) | |
| # if the data type is a feature class | |
| if desc.dataType == 'FeatureClass': | |
| # report the full path and spatial reference wkid of the data | |
| print('{0} - {1}'.format(path, desc.spatialReference.projectionCode)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment