<?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: Can't load Web Maps or Feature Layers in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1586156#M11163</link>
    <description>&lt;P&gt;I am also encountering same issue at Map(webmapitem) for all webmaps. it was working fine before .&lt;/P&gt;</description>
    <pubDate>Mon, 17 Feb 2025 21:52:18 GMT</pubDate>
    <dc:creator>vijaybadugu</dc:creator>
    <dc:date>2025-02-17T21:52:18Z</dc:date>
    <item>
      <title>Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575781#M11059</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I'm working with the arcgis API for Python, but I'm having some serious issues getting it to work as expected.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I'm using portal-tier authentication.&lt;/P&gt;&lt;P&gt;First I try loading a Web Map directly. That gives me the following error.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS

portal = GIS(url="https://maps.xyz.com/portal", username="xyz", password="xyz")
web_map_id = 'xyz'
web_map = portal.content.get(web_map_id)
portal.map(web_map)

============
ValidationError: 3680 validation errors for Webmap
operationalLayers.5.AnnotationLayerArcGISAnnotationLayer.layerType
  Input should be 'ArcGISAnnotationLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.CatalogLayerCatalogLayer.layerType
  Input should be 'CatalogLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.CSVLayerCSV.layerType
  Input should be 'CSV' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.DimensionLayerArcGISDimensionLayer.layerType
...
  Field required [type=missing, input_value={'id': 911, 'layerDefinit...efaultVisibility': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing
operationalLayers.5.LinkChartLayerLinkChartLayer.layerType
  Input should be 'LinkChartLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Subsequently, I tried starting with an empty map, and loading Feature Layers directly&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.layers import Service

layers = Service(
    "https://xyz.com/arcgis/rest/services/xyz/xyz/FeatureServer"
)
m = portal.map()
m.basemap.basemap = 'satellite'

for lyr in layers.layers:
    m.content.add(lyr)

m.center = [xyz, xyz]
m.zoom = 30&lt;/LI-CODE&gt;&lt;P&gt;That just outputs the basemap, with no layers to be seen.&lt;/P&gt;&lt;P&gt;Printing `layers` gives the following&lt;/P&gt;&lt;LI-CODE lang="python"&gt;&amp;lt;FeatureLayerCollection url:"https://xyz.com/arcgis/rest/services/xyz/xyz/FeatureServer"&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Is this maybe a permission issue? I have no other ideas left. I've followed the guides in the documentation.&lt;BR /&gt;Also, this is all on version 2.4.0&lt;BR /&gt;&lt;BR /&gt;Cheers.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 14:23:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575781#M11059</guid>
      <dc:creator>torbenal</dc:creator>
      <dc:date>2025-01-15T14:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575803#M11060</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/869678"&gt;@torbenal&lt;/a&gt;.,&lt;/P&gt;&lt;P&gt;.map() is for use with Notebooks. If you are using a script for version 2.4.0 try the following...&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;from arcgis.gis import GIS
from arcgis.map import Map

## access portal
portal = GIS(url="URL", username="UserName", password="Password")

## the WebMap Item ID
web_map_id = "WM_ITEM_ID"

## get the WebMap as an Item Object
wm_item = portal.content.get(web_map_id)

## create a WMap object
map_obj = Map(wm_item)

## access elements of he Map obejct
print(map_obj)
print(map_obj.extent)
print(map_obj.basemap.basemap) # get basemap from BasemapManager

## add the layers from a Feature Service to the Map
fs_item = portal.content.get("FS_ITEMN_ID")

for layer in fs_item.layers:
    map_obj.content.add(layer)

## update the Map object
map_obj.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;Some of the Map properties/methods are only available with Notebooks such as center and zoom.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If using Notebooks you can perform the following.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;## Cell 1
from arcgis.gis import GIS
from arcgis.map import Map

## Cell 2: access portal
portal = GIS(url="URL", username="UserName", password="Password")

## Cell 3: Get the Map Object
web_map_id = "WM_ITEM_ID"
wm_item = portal.content.get(web_map_id)
map_obj = Map(wm_item)

map_obj
## your Map will appear

## CELL 4: Update Map properties
map.zoom = 30&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 15:07:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575803#M11060</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-01-15T15:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575843#M11062</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;I am using a Notebook. The main issue is I don't even get past calling the `Map()` initializer, due to the validation errors in my post.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 15:57:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575843#M11062</guid>
      <dc:creator>torbenal</dc:creator>
      <dc:date>2025-01-15T15:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575855#M11063</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/869678"&gt;@torbenal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;1. You need to first import the Map class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.map import Map&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Then you get your WebMap as an Item object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;wm_item = portal.content.get("WM_ITEM_ID")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;3. Next you create a Map object from the Item.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;map_obj = Map(wm_item)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your original post does not have number 1 and 3 above in place. You are trying to use the WebMap item as a parameter to the map() method which it won't accept. Check the map() method documentation &lt;A href="https://developers.arcgis.com/python/latest/api-reference/arcgis.gis.toc.html#arcgis.gis.GIS.map" target="_blank" rel="noopener"&gt;here&lt;/A&gt;. If you want to use a WebMap from your Portal follow the above and then you can simply call map_obj to display your map in the Notebook. Once displayed, you can add layers and alter the zoom.&lt;/P&gt;&lt;P&gt;map() is not the same as Map(). map() is a method from the GIS class. Map() is its own class and creates a Map object with it's own properties and methods. When you create a Map() object in Notebook it is essentially a prepopulated map(). The map() documentation has a link to the Map() class to use properties such as zoom and center.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:19:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575855#M11063</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-01-15T16:19:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575857#M11064</link>
      <description>&lt;P&gt;Hi&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766" target="_blank"&gt;@Clubdebambos&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Unfortunately, does not fix my issue. The following is from my Jupyter Notebook.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.map import Map
web_map_id = 'xyz'
wm_item = portal.content.get(web_map_id)
map_obj = Map(wm_item)
map_obj

---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[39], line 4
      2 web_map_id = '02280e1953a743a8b97f65782ca1512b'
      3 wm_item = portal.content.get(web_map_id)
----&amp;gt; 4 map_obj = Map(wm_item)
      5 map_obj

File ~/Documents/fluxense/flowzone/.venv_gis/lib/python3.10/site-packages/arcgis/map/map_widget.py:254, in Map.__init__(self, location, item, gis, **kwargs)
    250 self._helper._setup_gis_properties(gis)
    252 # Set up the map that will be used
    253 # either existing or new instance
--&amp;gt; 254 self._setup_webmap_properties(item)
    256 # Assign the definition to helper class. This is the pydantic dataclass.
    257 self._helper._set_widget_definition(self._webmap)

File ~/Documents/fluxense/flowzone/.venv_gis/lib/python3.10/site-packages/arcgis/map/map_widget.py:402, in Map._setup_webmap_properties(self, item)
    399 data = self._fix_basemap_data(data)
    401 # Use pydantic dataclass from webmap_spec
--&amp;gt; 402 self._webmap = ws.Webmap(**data)
    404 # For bookmarks class
    405 if self._webmap.bookmarks is None:

File ~/Documents/fluxense/flowzone/.venv_gis/lib/python3.10/site-packages/pydantic/main.py:164, in BaseModel.__init__(__pydantic_self__, **data)
    162 # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    163 __tracebackhide__ = True
--&amp;gt; 164 __pydantic_self__.__pydantic_validator__.validate_python(data, self_instance=__pydantic_self__)

ValidationError: 3680 validation errors for Webmap
operationalLayers.5.AnnotationLayerArcGISAnnotationLayer.layerType
  Input should be 'ArcGISAnnotationLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.CatalogLayerCatalogLayer.layerType
  Input should be 'CatalogLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.CSVLayerCSV.layerType
  Input should be 'CSV' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.DimensionLayerArcGISDimensionLayer.layerType
  Input should be 'ArcGISDimensionLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.FeatureLayerArcGISFeatureLayer.layerType
  Input should be 'ArcGISFeatureLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error
operationalLayers.5.GeoJSONLayerGeoJSON.layerType
...
  Field required [type=missing, input_value={'id': 911, 'layerDefinit...efaultVisibility': True}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing
operationalLayers.5.LinkChartLayerLinkChartLayer.layerType
  Input should be 'LinkChartLayer' [type=literal_error, input_value='ArcGISMapServiceLayer', input_type=str]
    For further information visit https://errors.pydantic.dev/2.4/v/literal_error&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:29:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575857#M11064</guid>
      <dc:creator>torbenal</dc:creator>
      <dc:date>2025-01-15T16:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575861#M11065</link>
      <description>&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":crying_face:"&gt;😢&lt;/span&gt;&lt;span class="lia-unicode-emoji" title=":loudly_crying_face:"&gt;😭&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I am unable to reproduce. In-fact, I tested your original code and could get it to work. If you create another WebMap manually and just add one layer and re-attempt does it work? Just to see if it is something wrong with the WebMap itself or the functionality.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2025 16:41:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1575861#M11065</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2025-01-15T16:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can't load Web Maps or Feature Layers</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1586156#M11163</link>
      <description>&lt;P&gt;I am also encountering same issue at Map(webmapitem) for all webmaps. it was working fine before .&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 21:52:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/can-t-load-web-maps-or-feature-layers/m-p/1586156#M11163</guid>
      <dc:creator>vijaybadugu</dc:creator>
      <dc:date>2025-02-17T21:52:18Z</dc:date>
    </item>
  </channel>
</rss>

