rgthurau

select by location and calculate field from update cursor row: help

Discussion created by rgthurau on Nov 5, 2011
Latest reply on Mar 20, 2013 by jencarta
Hi,
I'm trying to use update.cursor to do a spatial selection of another layer, then populate the selection layer with an attribute from the cursor layer. More specifically, I'm trying to select "parcLyr" by each feature in "JurLyr", then populate "parcLyr" field "Dist" with the value in "JurLyr" field "Jur_Name".

arcpy.MakeFeatureLayer_management(Jurs_dis, "JurLyr")
rows = arcpy.SearchCursor("JurLyr", "", "", "Jur_Name", "")
arcpy.MakeFeatureLayer_management(parcels, "parcLyr")
for row in rows:
    arcpy.SelectLayerByLocation_management("parcLyr", "HAVE_THEIR_CENTER_IN", "JurLyr", "", "NEW_SELECTION")
    arcpy.CalculateField_management("parcLyr", "Dist", "%s") %(row.Jur_Name)



I'm getting an "invalid character" error. I feel like I'm close.

Any help would be greatly appreciated.

Thanks!

Rich

Outcomes