clone_items() with item_mapping misses basemap layers
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
Research direction
Start at the Python API's content.clone_items entry point and trace how item_mapping is applied to Web Map JSON, comparing operationalLayers with baseMap.baseMapLayers. Reproduce the example with source and target item IDs, then verify that every matching baseMap itemId is replaced in the cloned Web Map data.
Written by the indexing model from the issue text.
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:
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
- Dominant language
- Python
- Stars
- 2.2k
- Forks
- 1.1k
- Avg merge
- 2h 40m
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Esri/arcgis-python-api
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Esri/arcgis-python-api#2513 · 1 comment ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Esri/arcgis-python-api#2453 · 3 comments ·
-
documentation enhancement
Difficulty 1/5 Under an hour Newbie friendliness 76/100
Esri/arcgis-python-api#2097 · 1 comment ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 58/100
Esri/arcgis-python-api#2537 · 3 comments ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 56/100
Esri/arcgis-python-api#2531 · 1 comment ·
All issues in Esri/arcgis-python-api
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100