AnsweredAssumed Answered

Selecting points within polygon and updating attributes using ArcPy?

Question asked by vakhtang_zuba on Nov 22, 2019
Latest reply on Jul 11, 2020 by sibghatullah86

HI Guys,

 

I have two layers, polygon (in code "Poly" and "Points") and point, i want to upload polygon layer attribute to point using intersect (like spatial join). E.g in polygon i have A and B features, i wont to update  their values in point layer features attributes which under polygons. When i run my code it runs, but uploads only one value from polygon layer, when i have two values fro different features.

 

 

Here is a code help me please:

 

import arcpy

>>> cur_pol = arcpy.da.SearchCursor("Poly","name")

>>> for row_pol in cur_pol:

...     arcpy.SelectLayerByLocation_management("Points","INTERSECT","Poly","","NEW_SELECTION")

...    

>>> for row in arcpy.da.SearchCursor("Points","my_field"):

...     cursor = arcpy.UpdateCursor("Points")

...     for row in cursor:

...         row.SeniSvna = row_pol[0]

...         cursor.updateRow(row)

...        

Outcomes