I have a script that takes a user-provided lat/long, plots it as a point and performs overlay analysis using
arcpy.Intersect_analysis() in order to acquire attributes of interest such as land ownership, county, and township/range. The script works correctly, yet townnship/range has gaps in the state of New Mexico, which will create an output with no geometry or attributes if the point overlays one of these gaps (see hypothetical example in screenshot).
The output of
arcpy_Intersect_analysis() is used in subsequent code, so I need to account for instances where township/range doesn't exist. Any ideas?
Would some use of a SearchCursor work? If the output of
arcpy.Intersect_analysis() was called "temp.shp", could code go something like this?
cursor = arcpy.da.SearchCursor("temp.shp", ["SHAPE@XY"]) for row in cursor: if row == None: do this... else: do that...
Code above does nothing of course, but if I could check the existence of the output feature's centroid, I'd be able to provide a work-around for instances where township/range is absent at the location of the point.