Skip to content

Instantly share code, notes, and snippets.

@rabbleNaut
Created March 20, 2014 13:04
Show Gist options
  • Save rabbleNaut/9663297 to your computer and use it in GitHub Desktop.
Save rabbleNaut/9663297 to your computer and use it in GitHub Desktop.
Uses Arcpy to iterate through features in a featuredataset to delete unwanted fields.
'''
batchFieldDelete.py
Iterate through features in featuredataset to delete unwanted fields.
Delete fields:
1 - Area_MI
2 - DOT_Feature
3 - Area_MI
'''
import arcpy
from arcpy import *
#hardcoded path to sde. consider creating model with input parameters for reusibility.
env.workspace = r"C:\Users\RABBEY-C\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\Comanche.sde\ENV_GIS.ENV_GIS.EMST_Districts"
#local drive for testing
#env.workspace = r"C:\Users\RABBEY-C\RA_GIS\Projects\RA_EMST\Updated_Phase_Features.gdb\District_Unions"
fcList = ListFeatureClasses()
for fc in fcList:
print "Updating feature class: %s" % fc
DeleteField_management(fc, ["DOT_TYPE", "DOT_FEATURE", "AREA_MI"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment