I have two feature classes:

COH_Address (points)

TAXLOTS_NOAT (polygons)

I am trying to find the best code for using a cursor to run through TAXLOTS_NOAT, grab the value for TLNO, and populate the field TLNO_GIS in the COH_Address feature class the TAXLOTS_NOAT feature class field TLNO

import arcpy
# Local variables:
COH_Address = "C:\\Users\\mclbr\\Desktop\\AddressTest.gdb\\Places\\COH_Address"
TAXLOTS_NOAT = "C:\\Users\\mclbr\\Desktop\\AddressTest.gdb\\TAXLOTS_NOAT"
arcpy.MakeFeatureLayer_management(TAXLOTS_NOAT, "TAXLOTS_NOAT")  
rows = arcpy.SearchCursor("TAXLOTS_NOAT", "", "", "TLNO", "")
arcpy.MakeFeatureLayer_management(COH_Address, "COH_Address")  
for row in rows:  
    arcpy.SelectLayerByLocation_management    ("COH_Address", "HAVE_THEIR_CENTER_IN", "TAXLOTS_NOAT", "", "NEW_SELECTION")  
    arcpy.CalculateField_management("COH_Address", "TLNO_GIS", "%(row.TLNO)", "PYTHON")

1 Answer 1


It looks like a Spatial Join is what you're after. It will assign attributes from one feature class to another based on spatial relationship.

outFc = "C:\\Users\\mclbr\\Desktop\\AddressTest.gdb\\COH_ADDR_SpatialJoin"
arcpy.SpatialJoin_analysis (COH_Address, TAXLOTS_NOAT, outFc)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.