Select to view content in your preferred language

Add all layers and tables from an item object with the content.add()

166
0
03-31-2025 06:02 AM
Status: Open
Labels (2)
Clubdebambos
MVP Regular Contributor

Please update the API to enable adding all Layers and Tables at once.

As of the ArcGIS API for Python version 2.4.0 and the introduction of the MapContent add() method, you can no longer add an item object that contains a Feature Layer and a Table. Below, I attempt to add a Feature Service to the Map that contains one Feature Layer and one Table. 

"""Access the Feature Service"""
niah_fs_item = agol.content.get("WM_ITEM_ID") # NIAH

"""Attempt to add the Feature Service with a Feature Layer and Table"""
webmap.content.add(
    item = niah_fs_item # this will fail!
)
ValueError: Cannot add a group layer with tables to the map. Please add the layers individually or as a list to the add method.

Clubdebambos_0-1743425926741.png

2.3.0 did this just fine. Now I have to add Feature Layers and Tables separately.