<?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 Re: WebMap object move_to_basemap() method will not move the layer to the basemap in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363491#M9445</link>
    <description>&lt;P&gt;Here's a workaround for now...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap

## Access AGOL
agol = GIS("home")

## WebMap Item ID
wm_item_id = "WM_ITEM_ID"

## get the webmap item as an item object
wm_item = agol.content.get(wm_item_id)

## create a WebMap object from webmap item
webmap = WebMap(wm_item)

## Get the layer of interest
basemap_lyr = [lyr for lyr in webmap.layers if lyr.title == "Dark Gray Base"][0]

## Convert lyr definition to a dictionary
basemap_lyr_dict = dict(basemap_lyr)

## Remove the basemap layer from the Map
webmap.remove_layer(basemap_lyr)

## This needs to be called to make the remove layer stick
status = webmap.update()
print(status)

## Re-get the updated webmap item
wm_item = agol.content.get(wm_item_id)

## Get the webmap item data
item_data = wm_item.get_data()

## Update the Basemap list with the dictionary
item_data["baseMap"]["baseMapLayers"].append(basemap_lyr_dict)

## Define the webmap item properties
wm_item_properties = {"text":item_data}

## Update the webmap item properties
wm_item.update(item_properties=wm_item_properties)&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 21 Dec 2023 10:02:40 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2023-12-21T10:02:40Z</dc:date>
    <item>
      <title>WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363107#M9441</link>
      <description>&lt;P&gt;ArcGIS API for Python version 2.2.0.1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the move_from_basemap() to move basemap to a layer.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap

## Access AGOL
agol = GIS("home")

## get webmap item
wm_item = agol.content.get("WM_ITEM_ID")

## create WebMap object
webmap = WebMap(wm_item)

## get basemap definition
basemap_lyr = webmap.definition["baseMap"]["baseMapLayers"][0]

## call move_from_basemap
webmap.move_from_basemap(basemap_lyr)

## update basemap
webmap.update()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works perfectly! Now going in the other direction with move_to_basemap()&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap

## Access AGOL
agol = GIS("home")

## get webmap item
wm_item = agol.content.get("WM_ITEM_ID")

## create WebMap object
webmap = WebMap(wm_item)

## get layer definition
basemap_lyr = [lyr for lyr in webmap.layers if lyr.title == "Dark Gray Base"][0]

## move to basemap
webmap.move_to_basemap(basemap_lyr)

## update webmap
webmap.update()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am returned this error..&lt;/P&gt;&lt;LI-CODE lang="python"&gt;arcgis.gis.Error: This layer type cannot be added as a basemap. See method description to know what layer types can be moved to basemap.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The layer is a VectorTileLayer and as per &lt;A href="https://developers.arcgis.com/python/api-reference/arcgis.mapping.toc.html#arcgis.mapping.WebMap.move_to_basemap" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; should work!! I mean, its a layer that I switched from the basemap in the first place.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    {
      "id": "dark-gray-base-layer",
      "opacity": 1,
      "title": "Dark Gray Base",
      "visibility": true,
      "layerType": "VectorTileLayer",
      "styleUrl": "https://www.arcgis.com/sharing/rest/content/items/5e9b3685f4c24d8781073dd928ebda50/resources/styles/root.json"
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 16:38:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363107#M9441</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2023-12-20T16:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363335#M9443</link>
      <description>&lt;P&gt;I think this one can be logged as a bug. The reference list is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;        layer_types = [
            "ArcGISTiledMapServiceLayer",
            "ArcGISImageServiceLayer",
            "ArcGISImageServiceVectorLayer",
            "ArcGISMapServiceLayer",
            "ArcGISTiledImageServiceLayer",
            "ArcGISVectorTileLayer",
        ]&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;But the layerType attribute is set to "VectorTileLayer." From a quick glance at the source, it looks like "ArcGISVectorTileLayer" is only defined in&amp;nbsp;arcgis/mapping/_types.py so I think the types are either incorrect or the logic needs to be updated to properly map to the types.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Dec 2023 22:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363335#M9443</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-12-20T22:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363482#M9444</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/86309"&gt;@EarlMedina&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you got a link to the process for reporting as a bug?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 09:24:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363482#M9444</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2023-12-21T09:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363491#M9445</link>
      <description>&lt;P&gt;Here's a workaround for now...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap

## Access AGOL
agol = GIS("home")

## WebMap Item ID
wm_item_id = "WM_ITEM_ID"

## get the webmap item as an item object
wm_item = agol.content.get(wm_item_id)

## create a WebMap object from webmap item
webmap = WebMap(wm_item)

## Get the layer of interest
basemap_lyr = [lyr for lyr in webmap.layers if lyr.title == "Dark Gray Base"][0]

## Convert lyr definition to a dictionary
basemap_lyr_dict = dict(basemap_lyr)

## Remove the basemap layer from the Map
webmap.remove_layer(basemap_lyr)

## This needs to be called to make the remove layer stick
status = webmap.update()
print(status)

## Re-get the updated webmap item
wm_item = agol.content.get(wm_item_id)

## Get the webmap item data
item_data = wm_item.get_data()

## Update the Basemap list with the dictionary
item_data["baseMap"]["baseMapLayers"].append(basemap_lyr_dict)

## Define the webmap item properties
wm_item_properties = {"text":item_data}

## Update the webmap item properties
wm_item.update(item_properties=wm_item_properties)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 Dec 2023 10:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1363491#M9445</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2023-12-21T10:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1364989#M9467</link>
      <description>&lt;P&gt;&amp;nbsp;Hello, thanks for sharing your question.&amp;nbsp; You can report bugs and make enhancement requests to the Python API public GitHub repo here:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-python-api/issues" target="_blank"&gt;https://github.com/Esri/arcgis-python-api/issues&lt;/A&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;Nick Giner - Product Manager&lt;/P&gt;</description>
      <pubDate>Fri, 29 Dec 2023 16:18:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1364989#M9467</guid>
      <dc:creator>NicholasGiner1</dc:creator>
      <dc:date>2023-12-29T16:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: WebMap object move_to_basemap() method will not move the layer to the basemap</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1369907#M9517</link>
      <description>&lt;P&gt;Reported as bug here:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-python-api/issues/1739" target="_blank"&gt;https://github.com/Esri/arcgis-python-api/issues/1739&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 08:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/webmap-object-move-to-basemap-method-will-not-move/m-p/1369907#M9517</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-01-13T08:48:43Z</dc:date>
    </item>
  </channel>
</rss>

