Esri / mdcs-py

MDCS is an acronym for Mosaic Dataset Configuration Script and is the entry point to a collection of Python classes/libraries that could be consumed by a Python client application to complete a given workflow for creating a mosaic dataset, populating it with data, and setting all required/desired parameters.
Apache License 2.0
64 stars 29 forks source link

Mosaic Layer as input for MDCS #124

Closed MoritzMoreira closed 8 months ago

MoritzMoreira commented 1 year ago

In the ArcGIS Pro GUI and with ArcPy, I can add a Mosaic Layer (a Mosaic Dataset dragged to the contents area) to another Mosaic Dataset with Add Rasters and Raster Type Table. The reason I want to do this is that I want to import only a subset of items. I select these with arcpy.SelectLayerbyAttributes(), the expression being Name IN (list of element numbers). As it's name indicates, the function only works with Layers, so I need to turn the Mosaic Dataset into a Mosaic Layer before applying it.

For now I create the Mosaic Dataset with arcpy instead of MDCS. Another workaround could be a join of the mosaic dataset with the selection table?

arcpy.management.AddRastersToMosaicDataset("input_mosaicDS", "Table", "Mosaic_layer")

Is there a way to do this with the config file of a MDCS? When I put

`

DTK_$land$_$datum$
<raster_type>Table</raster_type>
<Sources>
      <data_path>mosaic_layer</data_path>
</Sources>  

`

the resulting Mosaic dataset is emtpy. I can create a MD in arcpy and then import it into antoher with MDCS, but of course it would be more elegant and efficient importing the layer directly.

vijaygit02 commented 8 months ago

@MoritzMoreira , I think what you want to do here is to just add a subset of records from inputmosaic to the output. In the Add Rasters tool there is an option to provided a filter on the InputMosaic, have you tried that? The query format is identical as "Select By Attributes" and you can pass the filter in the config file.

Apologies for late reply

MoritzMoreira commented 8 months ago

sorry, I am out of the project for some time. Trying with QGIS now.

vijaygit02 commented 8 months ago

@MoritzMoreira I'll be closing the issue. let us know if you need any help in future