I have 2 feature classes events (points) and districts (polygons).
Polygons
Points
I get new points every day and they need polygon (district) information.
I would like to copy over the fields Week, RecycleRt and RecyCollDay from the polygon feature class to the points.
This is the script that I have so far. I know the arcpy.da.UpdateCursor section is wrong, because I don't understand UpdateCursor and I'm getting a runtime error: Cannot find field 'Week'
import arcpy
arcpy.env.workspace = "\\\\gis\\RecyclingAuditUpdate"
PW = "\\\\Projects\\RecyclingAuditUpdate\\UpdateAudits.gdb"
VPub = "\\\\connections\\AuthUser@VPub_Prd.sde"
RecyAudit = PW +"\\RecyclingAudit"
RecyDistrict = VPub + "\\RecyclingDistrict"
# Select new records
NewSelection = arcpy.SelectLayerByAttribute_management (RecyAudit,"NEW_SELECTION",["Week IS NULL AND RecycleRt IS NULL AND RecyCollDay IS NULL"],"NON_INVERT")
# Select intersecting districts
UpDistricts = arcpy.SelectLayerByLocation_management (RecyDistrict,"INTERSECT",NewSelection, "","NEW_SELECTION")
Start edit session
edit = arcpy.da.Editor(PW)
edit.startEditing(True, False)
# Update Week, RecycleRt and RecyCollDay fields in RecyclingAudit layer
updateFields = ["Week", "RecycleRt", "RecyCollDay"]
with arcpy.da.UpdateCursor(NewSelection, updateFields) as update_cursor:
for row in update_cursor:
row[1] = "Week"
row[2] = "RecycleRt"
row[3] = "RecyCollDay"
update_cursor.updateRow(row)
Any guidance would be really appreciated. Thanks!