<?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: Simple way to export a Layer List for a Web Map to Text in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1476750#M59304</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mean code that can look within group layers to pull out the layers within? If so, I've got a function that can handle those as well! Works for any number of levels of grouping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def unnestlayers(layer):
    wmlayers = []
    for lyr in layer.layers:
        try:
            if hasattr(lyr, "layers"):
                wmlayers += unnestlayers(lyr)
            else:
                wmlayers.append(lyr)
        except:
            print("Something went wrong")

    return wmlayers&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then just input the webmap and it should spit out a list of the actual layers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layers = unnestlayers(web_map)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 May 2024 05:28:09 GMT</pubDate>
    <dc:creator>JoshuaSharp-Heward</dc:creator>
    <dc:date>2024-05-22T05:28:09Z</dc:date>
    <item>
      <title>Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608298#M30380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a simple way to export the layer list from a web map (built with WAB) to a text file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 May 2017 16:47:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608298#M30380</guid>
      <dc:creator>BrianO_keefe</dc:creator>
      <dc:date>2017-05-25T16:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608299#M30381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;open the feature service in arcmap (in catalog you will see an option for feature services, then use arcpy to list the layers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2017 12:15:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608299#M30381</guid>
      <dc:creator>Lake_Worth_BeachAdmin</dc:creator>
      <dc:date>2017-06-05T12:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608300#M30382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to do this for all services at once? Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 14:27:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608300#M30382</guid>
      <dc:creator>LindsyHales_Bentley</dc:creator>
      <dc:date>2020-07-09T14:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608301#M30383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 14:53:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608301#M30383</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T14:53:00Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608302#M30384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I have both of those.&amp;nbsp; Any help is appreciated!! Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 14:55:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608302#M30384</guid>
      <dc:creator>LindsyHales_Bentley</dc:creator>
      <dc:date>2020-07-09T14:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608303#M30385</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Easy then!&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;gis &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; GIS
&lt;SPAN class="keyword token"&gt;from&lt;/SPAN&gt; arcgis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping &lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; WebMap
gis &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; GIS&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'pro'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="comment token"&gt;# if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')&lt;/SPAN&gt;
wmItemId &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;""&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;#put the id of the webmap in here&lt;/SPAN&gt;
wmItem &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; gis&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;content&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;get&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;wmItemId&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
wm &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; WebMap&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;wmItem&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; lyr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; wm&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layers&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;lyr&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;title&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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&amp;nbsp;it should print out all the layers for the given webmap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:02:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608303#M30385</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2021-12-12T02:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608304#M30386</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 15:07:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608304#M30386</guid>
      <dc:creator>LindsyHales_Bentley</dc:creator>
      <dc:date>2020-07-09T15:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608305#M30387</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Glad to help out!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 15:08:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/608305#M30387</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2020-07-09T15:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1161824#M45400</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I took your script and tried adding in a lyr.url to get the url of the layers and it worked but sometimes it comes up with an exception saying "layer" instance has no attribute 'url' and I was wondering if you know what I can do to put an exception in there. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 06 Apr 2022 20:20:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1161824#M45400</guid>
      <dc:creator>Kayden75</dc:creator>
      <dc:date>2022-04-06T20:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1192785#M46986</link>
      <description>&lt;P&gt;Hi Kayden, sorry for the delay, didn't see your message until now. I've had this issue in the past with vector tile layers (possibly from the basemap?) as they have an attribute called "styleUrl" instead of "url", which you could handle with some code like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if layer['layerType'] == "VectorTileLayer":
    print(layer.styleUrl)
else:
    print(layer.url)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 00:28:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1192785#M46986</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2022-07-18T00:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1237766#M49169</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/223231"&gt;@JoshuaSharp-Heward&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I am getting this error when I am using your code on AGOL notebook&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS('home')# if running this from Notebook for ArcGIS in AGOL/Enterprise, replace this line with gis = GIS('home')
wmItemId = "myid" #put the id of the webmap in here
wmItem = gis.content.get(wmItemId)
wm = WebMap(wmItem)
for lyr in wm.layers:
    print(lyr.title)‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  Input In [8]
    print(lyr.title)‍‍‍‍‍‍‍‍
                    ^
SyntaxError: invalid non-printable character U+200D&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 05 Dec 2022 14:47:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1237766#M49169</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2022-12-05T14:47:21Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1238467#M49219</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;It looks to me like there was an issue with the copy pasting of the code - try deleting the whole line "print(lyr.title)" and re-typing it manually, and let me know if that resolves it!&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2022 19:55:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1238467#M49219</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2022-12-06T19:55:42Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1240356#M49315</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/223231"&gt;@JoshuaSharp-Heward&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sorry for late respond. I manually re-type it and it is working. Just one more question&lt;BR /&gt;Do you know how can I modifie your code to get URL of each layers in webmap&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 21:02:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1240356#M49315</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2022-12-12T21:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1240365#M49316</link>
      <description>&lt;P&gt;No worries, glad to hear it's working now!&lt;/P&gt;&lt;P&gt;You can replace "lyr.title" with "lyr.url" to print out the url of a layer. Best to do it in an if statement like so:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if hasattr(lyr, "url"):
   print(lyr.url)&lt;/LI-CODE&gt;&lt;P&gt;as there are some layer types that don't have "url" attribute (for example, vector tile services have a 'styleUrl' instead) and if you don't have that step then the code will fail when it hits one of those layers. Also note that this simple bit of code above to print out the layers in a map doesn't handle group layers, I'd have to fetch another couple lines of code to deal with that if you need that functionality.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Dec 2022 21:24:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1240365#M49316</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2022-12-12T21:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1242765#M49459</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/223231"&gt;@JoshuaSharp-Heward&lt;/a&gt;&amp;nbsp;Thanks this is pretty good.&lt;BR /&gt;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.&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 19:06:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1242765#M49459</guid>
      <dc:creator>anonymous55</dc:creator>
      <dc:date>2022-12-20T19:06:04Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1242877#M49464</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can loop through all of the webmaps in your arcgis online by using the following code:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;web_maps = gis.content.search(query="", item_type="Web Map", max_items=10000)
for item in web_maps:
   wm = WebMap(item)&lt;/LI-CODE&gt;&lt;P&gt;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 &lt;A href="https://github.com/joshsharpheward/gis-administration/blob/master/search_webmaps_for_services.py" target="_blank"&gt;https://github.com/joshsharpheward/gis-administration/blob/master/search_webmaps_for_services.py&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Josh&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2022 03:14:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1242877#M49464</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2022-12-21T03:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1476577#M59300</link>
      <description>&lt;P&gt;Would it be a hassle to provide an example that pulls group layers as well?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 21:22:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1476577#M59300</guid>
      <dc:creator>TukFull</dc:creator>
      <dc:date>2024-05-21T21:22:12Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1476750#M59304</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Do you mean code that can look within group layers to pull out the layers within? If so, I've got a function that can handle those as well! Works for any number of levels of grouping.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def unnestlayers(layer):
    wmlayers = []
    for lyr in layer.layers:
        try:
            if hasattr(lyr, "layers"):
                wmlayers += unnestlayers(lyr)
            else:
                wmlayers.append(lyr)
        except:
            print("Something went wrong")

    return wmlayers&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then just input the webmap and it should spit out a list of the actual layers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layers = unnestlayers(web_map)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 05:28:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1476750#M59304</guid>
      <dc:creator>JoshuaSharp-Heward</dc:creator>
      <dc:date>2024-05-22T05:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Simple way to export a Layer List for a Web Map to Text</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1477059#M59308</link>
      <description>&lt;P&gt;This worked great, thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2024 16:08:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/simple-way-to-export-a-layer-list-for-a-web-map-to/m-p/1477059#M59308</guid>
      <dc:creator>TukFull</dc:creator>
      <dc:date>2024-05-22T16:08:36Z</dc:date>
    </item>
  </channel>
</rss>

