I'm real new to arcpy and am trying to feel my way around. I have an application where the user supplies either a point/polygon in JSON, I convert that to an ESRI geometry and now I'm trying to find out if it intersects with a layer. I'm kind of lost. The touches function provided on each geometry I'm thinking won't do because it seems touch only checks if a geom touches the border of another geom. Is this accurate?Also it seems it can be done using Select_analysis? I saw a caution about it only working for Feature layers and not feature classes. Huh? What's the difference even. I tried using Intersect_analysis. Not sure if this will make sense but here's the code.def geom_intersects(esri_geom, layer):
ts = int(time.time())
intersect_tbl = "in_memory\\tmp_tbl_intersection_%s" % ts
if arcpy.Exists(intersect_tbl):
arcpy.management.Delete(intersect_tbl)
rows = arcpy.SearchCursor(layer)
for (index, row) in enumerate(rows):
arcpy.analysis.Intersect([row.Shape, esri_geom], intersect_tbl + "_" + str(index))
intersect_rows = arcpy.SearchCursor(intersect_tbl + "_" + str(index))
if intersect_rows:
for intersect_row in intersect_rows:
print "Intersection here: ", intersect_row.Shape.area, intersect_row.Shape.length, intersect_row.Shape.type
print " --- We have an intersection here: %s" % row.FID
return True
return False