Am trying to check if the points in a point shapefile are contained within a polygon shapefile and if so, to populate a field in the point shapefile with the name of the polygon and to populate the field with 'no' if otherwise. Am guessing I have to use the contains method and I have searched but can't find examples of it used with the new data access module. I have put random values in the file paths for confidentiality. This is the code that I have but it returns an error of return convertArcObjectToPythonObject(self._arc_object.Contains(*gp_fixargs([second_geometry])))
here's the code:
import arcpy arcpy.env.workspace=r"K:\Shared\test" fc="kkk.shp" fc1="mmm.shp" cursor=arcpy.da.SearchCursor(fc,["SHAPE@","Reserv"]) for row in cursor: cursor1=arcpy.da.SearchCursor(fc1,["SHAPE@","NAME"]) for rowb in cursor1: if rowb.contains(row): row=rowb else: row="No" del row del row1 del cursor del cursor1
Please help me figure out what's going on.