I have polygon.shp and point.shp. I have to check certain attribute where if the point is inside a polygon it have to be True and if it is outside the polygon it has to be False.
I am new to ArcPy and I have no idea which logic to use to find this.
#i tried spatial join, but the thing is that so many points with True as their value got left out
import arcpy
arcpy.env.workspace = 'C:/Desktop/New jersey_Completed'
outworkspace = 'C:/Desktop/Output'
Polygon = "C:/New_Jersey_BFP_Part-2.shp"
point = 'C:/New jersey_Completed/New_Jersey_20220224_Property_Points_Part-2.shp'
arcpy.AddField_management(point, "REST", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")
fields = ['point', 'Polygon']
with arcpy.da.SearchCursor(point, fields) as cursor:
# row[0] corresponds to the newly create 'REST' attribute..0 index
# row[1] accesses the geometry of your point feature class.. 1 index
if row[1].contain([0]):
row[0] = 'True'
else:
row[0] = 'False'
cursor.updateRow(row)
fieldslist). While it is possible to use an UpdateCursor to select features in another layer and update accordingly, you're missing quite a bit of code to attempt that.