Simple way to export a Layer List for a Web Map to Text

773
7
05-25-2017 09:47 AM
BrianO_keefe
Regular Contributor II

Is there a simple way to export the layer list from a web map (built with WAB) to a text file?

7 Replies
Lake_Worth_BeachAdmin
Regular Contributor

open the feature service in arcmap (in catalog you will see an option for feature services, then use arcpy to list the layers

0 Kudos
LindsyHales_Bentley
New Contributor III

Is there a way to do this for all services at once? Thanks!

0 Kudos
JoshuaSharp-Heward
Occasional Contributor

Do you have access to ArcGIS Pro or ArcGIS Notebook (in AGOL or enterprise)? If so this can be done using the ArcGIS API for Python pretty easily!

LindsyHales_Bentley
New Contributor III

Yes, I have both of those.  Any help is appreciated!! Thank you!

0 Kudos
JoshuaSharp-Heward
Occasional Contributor

Easy then!

from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS('pro')# if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')
wmItemId = "" #put the id of the webmap in here
wmItem = gis.content.get(wmItemId)
wm = WebMap(wmItem)
for lyr in wm.layers:
print(lyr.title)

I wrote that to be run from the Python window in Pro, but see my note in line 3 about using it in ArcGIS Notebook. Just put the ID of the web map item into line 4 and it should print out all the layers for the given webmap.

LindsyHales_Bentley
New Contributor III

Thank you so much!!

JoshuaSharp-Heward
Occasional Contributor

Glad to help out! 

0 Kudos