<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Copy layers between webmaps not working. in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copy-layers-between-webmaps-not-working/m-p/1183887#M7499</link>
    <description>&lt;P&gt;Why is this not working for copy layers from one webmap to another?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;map1 = gis.content.get(&amp;lt;itemID_1&amp;gt;)
map2 = gis.content.get(&amp;lt;itemID_2&amp;gt;)

webmap1 = WebMap(map1)
webmap2 = WebMap(map2)

layer = webmap2.definition.operationalLayers[0]
webmap1.definition.operationalLayers.append(layer)

webmap1.update()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get no error messages, but there is no alteration on webmap1 as well.&lt;/P&gt;&lt;P&gt;It add the layer to the webmap1 when i check for it before webmap1.update(), but this update has no effect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2022 16:35:49 GMT</pubDate>
    <dc:creator>HenriqueJoner</dc:creator>
    <dc:date>2022-06-17T16:35:49Z</dc:date>
    <item>
      <title>Copy layers between webmaps not working.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copy-layers-between-webmaps-not-working/m-p/1183887#M7499</link>
      <description>&lt;P&gt;Why is this not working for copy layers from one webmap to another?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;map1 = gis.content.get(&amp;lt;itemID_1&amp;gt;)
map2 = gis.content.get(&amp;lt;itemID_2&amp;gt;)

webmap1 = WebMap(map1)
webmap2 = WebMap(map2)

layer = webmap2.definition.operationalLayers[0]
webmap1.definition.operationalLayers.append(layer)

webmap1.update()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get no error messages, but there is no alteration on webmap1 as well.&lt;/P&gt;&lt;P&gt;It add the layer to the webmap1 when i check for it before webmap1.update(), but this update has no effect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 16:35:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/copy-layers-between-webmaps-not-working/m-p/1183887#M7499</guid>
      <dc:creator>HenriqueJoner</dc:creator>
      <dc:date>2022-06-17T16:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Copy layers between webmaps not working.</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/copy-layers-between-webmaps-not-working/m-p/1187695#M7517</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/476120"&gt;@HenriqueJoner&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There might be a couple of ways to do this but the below has worked successfully.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS

agol = GIS("home")

map1 = agol.content.get("***wm1_id***")
map2 = agol.content.get("***wm2_id***")

map1_data = map1.get_data()
map2_data = map2.get_data()

## the layer index to copy
## index 0 is the bottom layer and those above
## increment by 1 for each layer
lyr2copy = map2_data['operationalLayers'][0]

## add the JSON or the layer to the JSON of the other 
## WebMap operationalLayers
map1_data['operationalLayers'] = map1_data['operationalLayers'] + [lyr2copy]

## Update the data for the map that the layer was coppied to
item_properties = {"text":map1_data}
map1.update(item_properties=item_properties)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 09:08:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/copy-layers-between-webmaps-not-working/m-p/1187695#M7517</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2022-06-29T09:08:59Z</dc:date>
    </item>
  </channel>
</rss>

