Is there a simple way to export the layer list from a web map (built with WAB) to a text file?
Hi,
You can loop through all of the webmaps in your arcgis online by using the following code:
web_maps = gis.content.search(query="", item_type="Web Map", max_items=10000) for item in web_maps: wm = WebMap(item)
Then use the rest of the code that you have been using! If you have any issues you can refer back to this code in github that I put together which searches through web maps for a particular web service https://github.com/joshsharpheward/gis-administration/blob/master/search_webmaps_for_services.py
Cheers,
Josh
@JoshuaSharp-Heward Thanks this is pretty good.sorry to bother you with this. Do you know how can I run this for my whole arcgis online webmaps? Instead of manually copy paste ItemId for each webmap.
Thanks again for your help
Easy then!
<SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis <SPAN class="keyword token">import</SPAN> GIS <SPAN class="keyword token">from</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>mapping <SPAN class="keyword token">import</SPAN> WebMap gis <SPAN class="operator token">=</SPAN> GIS<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'pro'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="comment token"># if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')</SPAN> wmItemId <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN> <SPAN class="comment token">#put the id of the webmap in here</SPAN> wmItem <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN>wmItemId<SPAN class="punctuation token">)</SPAN> wm <SPAN class="operator token">=</SPAN> WebMap<SPAN class="punctuation token">(</SPAN>wmItem<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">for</SPAN> lyr <SPAN class="keyword token">in</SPAN> wm<SPAN class="punctuation token">.</SPAN>layers<SPAN class="punctuation token">:</SPAN> <SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>lyr<SPAN class="punctuation token">.</SPAN>title<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
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.
Yes, I have both of those. Any help is appreciated!! Thank you!
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!
Is there a way to do this for all services at once? Thanks!
open the feature service in arcmap (in catalog you will see an option for feature services, then use arcpy to list the layers
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.