<?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: Listing layers in Web Map Error in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1369607#M9514</link>
    <description>&lt;P&gt;It looks like the URL property is specific to certain kinds of items. Maybe try item.homepage&lt;/P&gt;</description>
    <pubDate>Fri, 12 Jan 2024 15:51:33 GMT</pubDate>
    <dc:creator>Dan_Brumm</dc:creator>
    <dc:date>2024-01-12T15:51:33Z</dc:date>
    <item>
      <title>Listing layers in Web Map Error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1368711#M9512</link>
      <description>&lt;P&gt;Hi all.&lt;/P&gt;&lt;P&gt;I've got some code (below) to list the layers in all web mappers.&lt;/P&gt;&lt;P&gt;It works fine when just listing the Title of the layers, but when I had a parameter to print the layer.url as well as the layer title:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;"&lt;EM&gt;print('\t',l,layer.title)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kalu_Ribush_0-1704929168029.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/91154iC9C8B265DF62B694/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Kalu_Ribush_0-1704929168029.png" alt="Kalu_Ribush_0-1704929168029.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This occurs when trying to get the URL for a third party, public WMTS layer, in the Web Map.&lt;/P&gt;&lt;P&gt;Can I modify the code to ignore this error, or list something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;from arcgis.gis import GIS&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;from arcgis.mapping import WebMap&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;import arcpy&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;gis = GIS("pro")&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;# Search for web maps based on the query. Set max_items to -1 for all maps&lt;BR /&gt;&lt;/EM&gt;&lt;EM&gt;webmaps_contents = gis.content.search("*",item_type="Web Map", max_items=500)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;print('Number of Web Maps found: ' + str((len(webmaps_contents))))&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;n=0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;#create web map objects from search results and print the web map title and layer name&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;for webmap_item in webmaps_contents:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if webmap_item.content_status != "deprecated":&amp;nbsp; # Optional to include&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n=n+1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(n,webmap_item.title,webmap_item.content_status)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; webmap_obj = WebMap(webmap_item)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l=0&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for layer in webmap_obj.layers:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l=l+1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print('\t',l,layer.title)&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;print("Finished")&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 23:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1368711#M9512</guid>
      <dc:creator>Kalu_Ribush</dc:creator>
      <dc:date>2024-01-10T23:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Listing layers in Web Map Error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1369607#M9514</link>
      <description>&lt;P&gt;It looks like the URL property is specific to certain kinds of items. Maybe try item.homepage&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jan 2024 15:51:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1369607#M9514</guid>
      <dc:creator>Dan_Brumm</dc:creator>
      <dc:date>2024-01-12T15:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Listing layers in Web Map Error</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1369910#M9519</link>
      <description>&lt;P&gt;You can use Python try/except statements to handle the error gracefully and continue with code execution.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jan 2024 09:18:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/listing-layers-in-web-map-error/m-p/1369910#M9519</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-01-13T09:18:49Z</dc:date>
    </item>
  </channel>
</rss>

