I'm developing an arcpy script that uses Manage Tile Cache. One of the parameters is "Area of Interest" which takes a Feature Set datatype.
In GIS I can select on the mosaic dataset, then use the footprint as input for that parameter and the tool works.
So programmatically I tried a similar approach but the selection fails. How can I capture the feature set of a mosaic dataset selection?
EDIT - Updated var names for mosaic dataset `input_md`. From `test_md`
# change workspace to Imagery gdb
md_name = os.path.basename(input_md) # `input_md` is a valid mosaic dataset w/ rasters
base_gdb = os.path.dirname(input_md)
arcpy.env.workspace = base_gdb
# query footprint Area of Interest
aoi_query = "Category = 1 And Name = 'DrakesCornerSP-2019-08-08_COG'"
# NOTE: Issue here. How to obtain Feature Set for `area_of_interest` param?
arcpy.management.SelectLayerByAttribute(r"{}\Footprint".format(md_name), "NEW_SELECTION", aoi_query, None) # fail
# arcpy.management.SelectLayerByAttribute(md_name, "NEW_SELECTION", input_aoi_query, None) # fail
# arcpy.management.SelectLayerByAttribute(input_md, "NEW_SELECTION", input_aoi_query, None) # fail
# get scales list from cache .xml
lst_scales = read_cache_xml(input_service_cache)
base_folder = os.path.dirname(input_service_cache)
mode = "RECREATE_ALL_TILES"
cacheName = os.path.basename(input_service_cache)
useScheme = "ARCGISONLINE_SCHEME"
# update service cache
with arcpy.EnvManager(parallelProcessingFactor="100"):
arcpy.AddMessage(f'\n\tRebuilding cache tiles for image service:\n\t{cacheName}')
arcpy.ManageTileCache_management(in_cache_location = base_folder,
manage_mode = mode,
in_cache_name = cacheName,
in_datasource = input_md,
tiling_scheme = useScheme,
scales = lst_scales ,
area_of_interest = f"{input_md}\Footprint"
min_cached_scale = max(lst_scales),
max_cached_scale= min(lst_scales))