I have a multipart feature class of cities. I want to run a search cursor on a cities feature class where:
- one city is selected and a select layer by location is run to select all parcels that are within a certain distance X;
- Values from the selected parcels are then summed together;
- move on to the next city record
Currently, I am having trouble getting my select by location statement correct. Instead of only selecting the parcels that are within distance X of one city, it's selecting all the parcels that are within distance X of all the cities in the feature class.
arcpy.MakeFeatureLayer_management(city, c_layer) cCursor = arcpy.SearchCursor(c_layer) print "Created search cursor on c_layer" arcpy.MakeFeatureLayer_management(parcel, p_layer) for row in cCursor: geoName = row.getValue("GEO_NAME") print geoName geoID = row.getValue("GEO_ID") print geoID arcpy.SelectLayerByLocation_management(p_layer, "WITHIN_A_DISTANCE", c_layer, search_radius, "NEW_SELECTION") print "Completed select by location on p_layer" y = arcpy.GetCount_management(p_layer) print y