Select to view content in your preferred language

Update datasource of MapService with Mosaic

126
2
Tuesday
ModyBuchbinder
Esri Regular Contributor

I have a map service that include Mosaic Dataset (Map service and NOT image service)

I am trying to use arcpy to update from one server to another.

I try to use layer.updateConnectionProperties but it does not work.

The closest I get is layer.updateConnectionProperties(None, ’https://newserver/arcgis/rest/map1/MapServer’, validation=False)

It gave me layer that have the correct source but is show with red exclamation mark and does not display.

The mosaic is really a group of 4 layers but only the group can be changed.

I noticed that is I try to open the properties in Pro and go to source the “set source” button is disabled.

Is it possible?

0 Kudos
2 Replies
TonyAlmeida
MVP Regular Contributor

A MapServer layer that contains a mosaic dataset is not a standard data source layer. When you add it to ArcGIS Pro, you are connecting to a Map Image Layer exposed by an ArcGIS Server map service, not directly to the underlying mosaic dataset.

Because the layer is service-based rather than dataset-based, the Set Source option is disabled. ArcGIS Pro does not treat the service URL as a replaceable workspace connection in the same way it does for feature classes, raster datasets, or direct mosaic dataset connections. As a result, methods such as updateConnectionProperties() generally cannot be used to repoint the layer to a different MapServer endpoint.

0 Kudos
ModyBuchbinder
Esri Regular Contributor

I found a simple solution.

The lyrx is really XML (or json). You just read it as simple text file (line by line, not as JSON) and replace the old URL with the new one (it exists in more then one line).

Works great.

Thanks

0 Kudos