Select to view content in your preferred language

Running Python code to add layers form one web map to another in AGOL,

286
0
11-06-2023 11:32 AM
Labels (1)
SanchezNuñez
Occasional Contributor

Hello everyone,

I am running this code, in ArcGIS Pro Notebook, to copy layers from one web map to another but it fails in the last lines.

Any advice?

gis = GIS("home")

# select Web Maps from item id
mapitem1 = gis.content.get('xxxxx')
display(mapitem1)

mapitem2 = gis.content.get('yyyyy')
display(mapitem2)

# get Web Map Objects
from arcgis.mapping import WebMap
wmo1 = WebMap(mapitem1)
wmo2 = WebMap(mapitem2)

# output operational layers
wmo1.definition['operationalLayers']
wmo2.definition['operationalLayers']

 

for layer in wmo1.definition.operationalLayers:
  wmo2.definition.operationalLayers.append(layer)


for layer in wmo1.definition.operationalLayers:
  wmo2.definition['operationalLayers'].append(layer)

0 Kudos
0 Replies