I am trying to use Select Layers By Location tool in Python.
I have a polygon feature class that I would like to iterate though each feature and do a select layers by location in order to get a list of layers that each polygon intersects with.
Can I use a search cursor to iterate through the polygons and pass the geometry to Select Layers By Location as the select_features parameter?
extents = sys.argv
#polygon shapefile containing 4 polygons
arcpy.env.workspace = "C:\Dataset.gdb"
#get extents spatial reference
ex_sp = arcpy.Describe(extents).spatialReference
fcs = arcpy.ListFeatureClasses()
with da.SearchCursor(extents,["SHAPE@"]) as scursor:
for row in scursor:
boundary = row
Output_Layer_Names, Count = arcpy.management.SelectLayerByLocation(in_layer=fcs, overlap_type="INTERSECT",
select_features=boundary, search_distance="", selection_type="NEW_SELECTION",
Any help is appreciated