Skip to content

clone_items() with item_mapping misses basemap layers #2491

Description

@knoopum

Describe the bug
When using clone_items with item_mapping on a Web Map with a custom basemap, it fails to update mapped items in the baseMap definition of the clone.

To Reproduce
Create a Web Map that contains a Tile Layer (hosted)/Map Service, and uses the same Tile Layer (hosted)/Map Service as its basemap. Ensure the Tile Layer (hosted)/Map Service is available on both the source and target GIS. Define the mapping of the item IDs from the source and target GIS in item_mapping when calling clone_Items.

For example:

cloned_items = target_gis.content.clone_items(
    items=[source_gis.content.get('web_map_item_id)],
    search_existing_items=False,
    item_mapping = {
        'tile_layer_item_id_on_source_gis': 'tile_layer_item_id_on_target_gis'
    }
)

clone_items does properly apply the item_mapping to the operationalLayers in the Web Map, but does not for the baseMap.

For example, the original Web Map's JSON Data definition contains:

    "operationalLayers": [
        {
            "id": "19d6daf5cc8-layer-216",
            "title": "ESGR 1998 GIS as layer",
            "url": "https://tiles.arcgis.com/tiles/4ezfu5dIwH83BUNL/arcgis/rest/services/ESGR_1998_GIS/MapServer",
            "itemId": "71c5068e7f2c47559ee645f10c712fed",
            "layerType": "ArcGISTiledMapServiceLayer"
        }
    ],
    "baseMap": {
        "baseMapLayers": [
            {
                "id": "19d6d80b60a-layer-56",
                "title": "ESGR 1998 GIS",
                "url": "https://tiles.arcgis.com/tiles/4ezfu5dIwH83BUNL/arcgis/rest/services/ESGR_1998_GIS/MapServer",
                "itemId": "71c5068e7f2c47559ee645f10c712fed",
                "layerType": "ArcGISTiledMapServiceLayer"
            }
        ],
        "title": "ESGR Basemap"
    },

While the cloned Web Map's JSON Data definition shows the item_mapping was successfully applied for occurrences under opeartionalLayers, it was not successful applied under baseMap:

    "operationalLayers": [
        {
            "id": "19d6daf5cc8-layer-216",
            "title": "ESGR 1998 GIS as layer",
            "url": "https://tiles.arcgis.com/tiles/ne8azYNvwFhMEpfh/arcgis/rest/services/ESGR_1998_DELETE/MapServer",
            "itemId": "e5deef62dd514c61b62b8b78790016db",
            "layerType": "ArcGISTiledMapServiceLayer"
        }
    ],
    "baseMap": {
        "baseMapLayers": [
            {
                "id": "19d6d80b60a-layer-56",
                "title": "ESGR 1998 GIS",
                "url": "https://tiles.arcgis.com/tiles/4ezfu5dIwH83BUNL/arcgis/rest/services/ESGR_1998_GIS/MapServer",
                "itemId": "71c5068e7f2c47559ee645f10c712fed",
                "layerType": "ArcGISTiledMapServiceLayer"
            }
        ],
        "title": "ESGR Basemap"
    },

Note that in this example, the Tile Layer (hosted)/Map Service was published on the target GIS with a different title, "ESGR 1998 DELETE", while the on the source GIS it is titled, "ESGR 1998".

Expected behavior
When using item_mapping, the expectation is that it will address all references to an item. So for a Web Map, it should also update items under baseMap, and not just operationalLayers.

Platform (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Python API Version: 2.4.3

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions