AnsweredAssumed Answered

Batch clip using arcpy script

Question asked by Myla-Rae on Apr 3, 2013

Hi, I am a GIS student, just starting out with python, and I am working on a project in which I want to create a custom script tool to clip a list of feature classes in a municipality to a single clip feature representing flood extent (FloodLevel). Can I create a list of the feature classes and then loop through the list to accomplish this? Here is what I am trying, though I cannot get the script to work at this point. I get an error that says: 'list' object is not callable. And I am not sure how to properly provide the output name for multiple features at once.

 

 

# Clip town features to a flood level polygon
# Define input parameter for floodLevel polygon
# Define infrastructure variables

FloodLevel = arcpy.GetParameterAsText(0)
FC1 = "Town_Boundary"
FC2 = "Parcels_2010"
FC3 = "Buildings_2009"
FC4 = "Trails"
FC5 = "Banff_Roads"
FC6 = "Water_Main"
FC7 = "Storm_Main"
FC8 = "Hydrant"

# Create list of feature classes and loop through the feature classes
Features = [FC1, FC2, FC3, FC4, FC5, FC6, FC7, FC8]

# Clip features in list to the FloodLevel polygon feature
for items in Features():
    arcpy.Clip_analysis(Features, FloodLevel, "Features_clip")

 

Any suggestions on how I could solve this scenario would be helpful!
Thanks,
Myla-Rae

 

(Curtis Price formatted code block 4/29/2015)

Outcomes