0

For some reason, SelectLayerByLocation_management is not filtering with arcgispro-py3 instances from ArcGIS Pro 2.8 and ArcGIS Server 10.9. Filtering works fine using ArcGIS Server 10.9 python2.7 installation. The mosaic dataset has about 280K rasters and the AOI polygon should only return a subset of matching OIDs based on intersect with the Mosaic Dataset footprint layer. I tried setting arcpy.env.outputCoordinateSystem to the MD SR (4326) before calling SelectLayerByLocation_management but that didn't work. Am I missing something?

import arcpy

path_md = r'H:/Data/Raster.gdb/MD1'
path_aoi_geojson = r'H:/Data/aoi.json'
PATHS = r'in_memory\paths'

with open(path_aoi_geojson) as f:
    geojson = json.loads(f.read())
ft = geojson['features'][0]
path_aoi = arcpy.AsShape(ft['geometry'], False)

arcpy.MakeMosaicLayer_management(path_md, 'MD_Lyr')
arcpy.SelectLayerByLocation_management(r'MD_Lyr\Footprint', 'INTERSECT', path_aoi)

oid_list = set(row[0] for row in arcpy.da.TableToNumPyArray(r'MD_Lyr\Footprint' ,"OID@"))

print(str(len(oid_list))

1 Answer 1

1

This turned out to be a bug on a VM using ArcGIS Server 10.9/ArcGIS Pro 2.8 arcgispro-py3 BUG-000143287.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.