Last active
August 29, 2015 14:02
-
-
Save glw/20483fd5d7f0ac9caa8c to your computer and use it in GitHub Desktop.
Arcpy batch field calculation
This file contains 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 arcpy | |
mxd = arcpy.mapping.MapDocument("Current") # finds metadata on your current MXD | |
layerlist = arcpy.mapping.ListLayers(mxd) # grabs a list of layers with in your MXD | |
del layerlist[3] #If you need to delete an item in the layerlist list | |
expr = "'Northwest'" # Variables to run the calculatefield function. **notice the extra '' within ""... | |
field = "Zone" # | |
# Goes through list and assigns expr to the field you specified | |
for l in layerlist: arcpy.CalculateField_management(l,field,expr,"PYTHON_9.3","#") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment