Thanks for previous help!
I'm trying to write an ArcPy script that will:
iterate through a feature class consisting of all the counties in a particular state
select each county and create a new feature class consisting of just that boundary
so that I can then use each county's boundary to do a sequence of geoprocessing steps.
I think I need to begin with a SearchCursor, and then iterate through the list of values (County names) it returns, and I can do that (and print out all the county names as a test), but I can't figure out how to insert each countyName into a SelectBy Attribute query, within the for: loop, by referring to the cursor.
So far, I have this snipped (preceded by the requisite set up steps, querying for IN Counties etc:
fc = r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb\IN_counties"
cursor = arcpy.da.SearchCursor(fc, ["NAME"])
for row in cursor:
arcpy.MakeFeatureLayer_management(r"E:\advAppScripting\testing\tornhazard\Indiana\Indiana.gdb\IN_counties", "counties_lyr")
arcpy.SelectLayerByAttribute_management("counties_lyr", "NEW_SELECTION", """"NAME" = row[0]""")
I know this WHERE clause is wrong, I just can't figure out what the value needs to be in order to select the county whose name is the first one in the cursor (and then the second, the third, etc) or if I should be going about this some other way....(Note: if I follow the "for row in cursor: with
print("{0}".format(row[0], I DO get a list of all the IN_county names, so I think my SearchCursor is functioning correctly.
THanks, Phil