Is there any more efficient/faster way to query a mosaic dataset raster catalog (footprints) for records matching an AOI polygon?

This implementation gets slower the larger the AOI polygon is.

import arcpy
import timeit

fgdb_path = 'H:/MY/FGDB/Rasters.gdb'
md_name = 'CIB1'
md_path = fgdb_path + '/' + md_name
md_cat_path = fgdb_path + '/AMD_' + md_name + '_CAT'
aoi_fc = 'H:/MY/FGDB.gdb/AOI'
out_paths = r'in_memory\paths'

# Get AOI poly from FC
with arcpy.da.SearchCursor(aoi_fc,'SHAPE@') as sCur:
     for row in sCur:
         aoi_poly = row[0]

start_time = timeit.default_timer()

# Create OID list of MD raster footprints that the AOI overlaps/contains
oid_list = []
with arcpy.da.SearchCursor(md_path,['SHAPE@', 'OID@']) as sCur:
     for row in sCur:
         if aoi_poly.overlaps(row[0]) or aoi_poly.contains(row[0]):

elapsed = timeit.default_timer() - start_time
print("Completed in " + str(elapsed))

System Info:

  • ArcPy w/ Pro 2.8 python3
  • ArcPy w/ ArcGIS Server 10.9 python3


  • Mosaic Dataset Footprint: 280K
  • Footprint size: 1SqMi
  • Small AOI footprint match: 10K results, 30s completion
  • Large AOI footprint match: 230K results, 230s completion
  • 3
    I think simple intersect of 2 polygons will be much-much faster.
    – FelixIP
    Sep 2, 2021 at 4:11
  • Are you using ArcPy with ArcGIS Pro or with ArcMap? What time are you currently seeing printed out?
    – PolyGeo
    Sep 2, 2021 at 4:57
  • @PolyGeo I added sys info and metrics Sep 2, 2021 at 17:12
  • @FelixIP thanks I'm testing arcpy.analysis.Intersect and arcpy.Intersect_analysis now, are these what you had in mind? Sep 2, 2021 at 17:47
  • Yes. Intersect (fid only) to in_memory dataset. Get unique fids.
    – FelixIP
    Sep 2, 2021 at 19:24

1 Answer 1


I tried on a Mosaic Dataset stored on an external hard-drive (40k rasters). This seems fastest:

enter image description here

Followed by:

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

Note my AOI layer made up from 2945 polygons made of 1779853 (1.8M!) points.

enter image description here

  • Thanks!! MakeMosaicLayer_management w/ SelectLayerByLocation_management is returning 200K+ AOI matches in under 10s :-) I noticed a few strange things though... SelectLayerByLocation_management does not appear to filter the footprint layer in specific python instances: AGS & ArcGIS Pro's arcgispro-py3. It works fine with AGS Python27 though... Not sure if this is a bug or not... Also Intersect_analysis w/ ONLY_FID returned the right amount of IDs but they didn't match the OIDs in from the source. Sep 3, 2021 at 4:49
  • SelectLayerByLocation_management not working on a VM using ArcGIS Server 10.9/ArcGIS Pro 2.8 arcgispro-py3 turned out to be a bug: BUG-000143287 Sep 29, 2021 at 0:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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