Friday, April 6, 2012

Snippet: Add a Spatial Index To All Feature Classes

Ever need to run a batch spatial index in a work space? Yes, well here is a snippet to help you out. import arcpy
from arcpy import env

env.workspace = arcpy.GetParameterAsText(0) # workspace parameter
fcs = arcpy.ListFeatureClasses()
for fc in fcs:
   arcpy.AddSpatialIndex_management(fc)
print 'fin'
Enjoy