Select to view content in your preferred language

Using item_mapping option with clone_items not remapping

47
0
yesterday
WhitneyWeber
Occasional Contributor

I am cloning content and a map from one AGOL Organizational account to another. I have cloned the feature layers and created a dictionary (item_mapping) of the source ids and resulting target ids.

{'71a362f0234f4d808afb98c786b77b3a': '071531fcd56d4bdf9ee326f5d216d899', '5132f1f6c4504204913e1de9695cdf8d': '91bd6c7a40ba4893b6f5e617ffc24e6c', '1105af2c21224b599d17827c1094408f': '1d05c4d11aec49cc9354d3314ef9283a', '39cccf853c924df98f56ba9a7c469f2e': '2cd6b672ee104ebbae02170987f84be8', '9a773ab569c44b179d583ad4e3b4763d': 'de2772099fd4402ab2d1a0e9840b90f7', '0fabd31bdd0e4ebabe7095c30b9cf831': 'd8f4246ccfa24e58b3032f7568ddc78e', '1d6520ba22ec4d31a3a17040f4f61024': '6cd9ed4462cc4605bcc23e62ae7cefa6', '16cbef787ce744b79e8f69265baaf2e8': '15e98f93773d437cb698bdd7b4a72e06', 'fefc0c039fdd45f69b80429737a9ca2a': '43d5713996b044989debcbd4d4ecd297', '9eba70367c8840238a3df60126a682aa': '58ee2ca97b034df9b45f951100066087', 'c9a3c3dcb00d49bbabe749c057cc9cef': 'caa80d040fa84fdd840a0ed4291de192', '95b614b1100747b6b01333d575249151': 'dfbf86bc61d645f9bd8f6bcb506c2c5f'}

Cloning using the item_mapping option was unsuccessful (still referenced source layers). So, it occurred to me that all the cloned layers are not in the map and hence created a second dictionary (webmap_item_mapping), in case this was the problem. This dictionary includes just the list of source and target ids for the layers in the map.

{'c9a3c3dcb00d49bbabe749c057cc9cef': 'caa80d040fa84fdd840a0ed4291de192', '0fabd31bdd0e4ebabe7095c30b9cf831': 'd8f4246ccfa24e58b3032f7568ddc78e', '5132f1f6c4504204913e1de9695cdf8d': '91bd6c7a40ba4893b6f5e617ffc24e6c', 'fefc0c039fdd45f69b80429737a9ca2a': '43d5713996b044989debcbd4d4ecd297', '39cccf853c924df98f56ba9a7c469f2e': '2cd6b672ee104ebbae02170987f84be8', '16cbef787ce744b79e8f69265baaf2e8': '15e98f93773d437cb698bdd7b4a72e06', '1105af2c21224b599d17827c1094408f': '1d05c4d11aec49cc9354d3314ef9283a'}

Cloning with the second dictionary also fails to remap the layers to the target layers. The map still points to the source layers. 

target.content.clone_items(items=[source_content], folder="Testing", copy_data=False, search_existing_items=True, item_mapping = webmap_item_mapping)

I have looked at this post which suggests that it may be due to the version of ArcGIS API for Python, but the results are the same whether using Pro (version '2.2.0.1') or AGOL.

Any insight into what I'm doing wrong would be much appreciated. I know this is supposed to work and I must be doing something simple wrong as it does according to the documentation .

0 Kudos
0 Replies