-
-
Save nvkelso/4091182 to your computer and use it in GitHub Desktop.
Build a spatial index for all shapefiles in a directory with ArcGIS
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 | |
from arcpy import env | |
import os | |
# Set the workspace for the ListFeatureClass function | |
# | |
env.workspace = "C:\\data\\mydata" | |
# Use the ListFeatureClasses function to return a list of | |
# all shapefiles. | |
# | |
fcList = arcpy.ListFeatureClasses() | |
# Create a spatial index for each shapefile | |
# | |
for fc in fcList: | |
arcpy.AddSpatialIndex_management(fc, "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment