Esri / Esri/arcgis-python-api

clone_items() with item_mapping misses basemap layers

Open
#2,491 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
2.2k
Forks
1.2k
Avg merge
2h 40m
Merged PRs (30d)
2

Description

**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:

```python
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:

```json
"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`:

```json
"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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.