arcmap - Passing a variable to Select By Attributes using a 'for' loop in Python -
i'm trying write script using 'select attribute' in arcmap. want create loop pass value select attribute expression. thinking along lines of: (x=number of polygons in shapefile)
for j in range(0,x,1): arcpy.makefeaturelayer_management ("layer", "temp") arcpy.selectlayerbyattribute_management ("temp","new_selection",""" "id" > j""") arcpy.copyfeatures_management("temp","slopeg5")
the rest of scripting should able handle, when run this, error code 000358, saying expression isn't valid. arcmap doesn't appear 'j' within select attributes.
the overall goal isolate polygon, use select location find polygons intersecting, find area of two, , divide percentage of main polygon covered second.
hopefully description clear enough help
i don't know arcmap, you're passing literal string "j" comparison, rather value of variable j
. mean:
arcpy.selectlayerbyattribute_management ("temp","new_selection", "id > %s" % j)
Comments
Post a Comment