<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Feature Set from Mosaic Dataset Selection Using Arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193459#M65015</link>
    <description>&lt;P&gt;It looks like it's just not finding the layer.&lt;/P&gt;&lt;P&gt;Try hard coding the entire path/name to the mosaic footprint dataset and see if you can get it working.&lt;/P&gt;&lt;P&gt;Then, you&amp;nbsp; can more easily figure out how/where it is losing it's way.&lt;/P&gt;&lt;P&gt;Also, a weird behavior that might be an issue.&amp;nbsp; If I use the makefeaturelayer with where clause "Category = 1", the created feature layer has exactly what I expect.&amp;nbsp; HOWEVER, if I add the AND Name = ...., the selection works correctly, but, the returned dataset is a raster catalog with the matching images in it, NOT a feature set of the footprints...&lt;/P&gt;&lt;P&gt;might need to make a selection/feature layer to get all the category 1 footprints, then perform a second query on that to get the feature.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2022 15:31:26 GMT</pubDate>
    <dc:creator>RhettZufelt</dc:creator>
    <dc:date>2022-07-19T15:31:26Z</dc:date>
    <item>
      <title>Feature Set from Mosaic Dataset Selection Using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193370#M65011</link>
      <description>&lt;P&gt;I'm developing an arcpy script that uses&amp;nbsp;&lt;A href="https://pro.arcgis.com/en/pro-app/2.8/tool-reference/data-management/manage-tile-cache.htm" target="_self"&gt;Manage Tile Cache&lt;/A&gt;. One of the parameters is "&lt;SPAN&gt;Area of Interest" which takes a Feature Set datatype.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;In GIS I can select on the mosaic dataset, then use the footprint as input for that parameter and the tool works.&lt;/P&gt;&lt;P&gt;So programmatically I tried a similar approach but the selection fails. How can I capture the feature set of a mosaic dataset selection?&lt;/P&gt;&lt;P&gt;EDIT - Updated var names for mosaic dataset `input_md`. From `test_md`&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# 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))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 14:40:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193370#M65011</guid>
      <dc:creator>KeonMonroe</dc:creator>
      <dc:date>2022-07-19T14:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Set from Mosaic Dataset Selection Using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193402#M65013</link>
      <description>&lt;P&gt;Not anywhere I can test, but I don't see where you are defining the aoi layer (test_md).&lt;/P&gt;&lt;P&gt;Instead of select by layer, have you tried making a feature layer of the selected footprints, then feeding that to the manage cache?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;in_features = r"{}\Footprint".format(md_name)
arcpy.management.MakeFeatureLayer(in_features, "test_md", aoi_query)
......
area_of_interest = "test_md"&lt;/LI-CODE&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 14:34:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193402#M65013</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2022-07-19T14:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Set from Mosaic Dataset Selection Using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193415#M65014</link>
      <description>&lt;P&gt;Sorry just updated vars in the original post. `test_md` was the old mosaic dataset name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyways I tried Make Feature Layer instead but getting an ExecuteError. Which is weird because I can make selections on the MD's footprint in GIS without any issues.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;ExecuteError&lt;/SPAN&gt;: Failed to execute. Parameters are not valid.
ERROR 000732: Input Features: Dataset BelleMead\Footprint does not exist or is not supported
Failed to execute (MakeFeatureLayer).&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 14:56:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193415#M65014</guid>
      <dc:creator>KeonMonroe</dc:creator>
      <dc:date>2022-07-19T14:56:02Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Set from Mosaic Dataset Selection Using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193459#M65015</link>
      <description>&lt;P&gt;It looks like it's just not finding the layer.&lt;/P&gt;&lt;P&gt;Try hard coding the entire path/name to the mosaic footprint dataset and see if you can get it working.&lt;/P&gt;&lt;P&gt;Then, you&amp;nbsp; can more easily figure out how/where it is losing it's way.&lt;/P&gt;&lt;P&gt;Also, a weird behavior that might be an issue.&amp;nbsp; If I use the makefeaturelayer with where clause "Category = 1", the created feature layer has exactly what I expect.&amp;nbsp; HOWEVER, if I add the AND Name = ...., the selection works correctly, but, the returned dataset is a raster catalog with the matching images in it, NOT a feature set of the footprints...&lt;/P&gt;&lt;P&gt;might need to make a selection/feature layer to get all the category 1 footprints, then perform a second query on that to get the feature.&lt;/P&gt;&lt;P&gt;R_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2022 15:31:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1193459#M65015</guid>
      <dc:creator>RhettZufelt</dc:creator>
      <dc:date>2022-07-19T15:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Set from Mosaic Dataset Selection Using Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1195023#M65055</link>
      <description>&lt;P&gt;Hard coding the full path of the Mosaic worked! I actually didn't need to modify the query, but it's odd you experienced that.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 17:44:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/feature-set-from-mosaic-dataset-selection-using/m-p/1195023#M65055</guid>
      <dc:creator>KeonMonroe</dc:creator>
      <dc:date>2022-07-22T17:44:40Z</dc:date>
    </item>
  </channel>
</rss>

