Web map content

06-05-2017 10:03 AM
New Contributor III

I am trying to list the contents of all my Web maps for a user. I have a list of all the Web Maps but cannot find how to list the Web Maps content.  Each web map has a number of layers, these shown in portal but want to know how to get this list in python.

4 Replies
Occasional Contributor II

It looks like you can access the layers of a web map using the ArcGIS API for Python.  The section "Fix errors in web map" on this link, show an example of doing that.

Using and updating GIS content | ArcGIS for Developers 


Occasional Contributor III

Here's a snippet that should get you started. This will return the JSON for a given webmap or list of webmaps in your portal.

from arcgis.gis import GIS
from IPython.display import display
import pandas as pd
import json

gis = GIS('url', 'username', 'password')

webmaps = gis.content.search('', 'Web Map', max_items = 500)

for webmap in webmaps:
    print('Title ' + webmap.title, '\nWebmapId ' +webmap.id, '\nOwner ' +webmap.owner)
    webmapJSON = webmap.get_data()
    for layer in webmapJSON['operationalLayers']:
New Contributor II

Thanks Seth! very helpful!

0 Kudos
New Contributor III

Finding this gem made my morning.

0 Kudos