<?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: Fetch wich layers in a map service are used in a web map in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333725#M9079</link>
    <description>&lt;P&gt;To get that information, you can take a look at the item data.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

conn = GIS("https://machine.domain.com/portal", "admin", "password")
item = conn.content.get(&amp;lt;itemID&amp;gt;)
item_data = item.get_data()
# Include the below line for prettified JSON
print(json.dumps(item_data, indent=4, sort_keys=True))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your case, the information you're looking for will be in:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;item_data["operationalLayers"]&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Sep 2023 13:36:12 GMT</pubDate>
    <dc:creator>EarlMedina</dc:creator>
    <dc:date>2023-09-29T13:36:12Z</dc:date>
    <item>
      <title>Fetch wich layers in a map service are used in a web map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333713#M9078</link>
      <description>&lt;P&gt;I want to fetch all layers that a Web map uses from a Map service.&lt;/P&gt;&lt;P&gt;If I have a Web map with a Map service - the Map service contains 10 layers but only 5 of them are used in the Web map. How do I fetch these in the API?&lt;/P&gt;&lt;P&gt;Here is my code for fetching the Web map, but it only gets the Map services, nothing about wich layers in the Map service that are used:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap, WebScene

gis = GIS(url="https://geoportal.website.se/portal/", username="*****", password="****")

web_maps = gis.content.search(query="", item_type="Web Map", max_items = 5) 

for map in web_maps:
	maptitle = map['title']
	mapid = map['id']

	web_map = WebMap(gis.content.get(map.id))
	layers = web_map.layers

	for layer in layers:
		layerType = layer.layerType
		url = layer.url
		itemId = layer.itemId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 12:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333713#M9078</guid>
      <dc:creator>ÅsaBlomberg</dc:creator>
      <dc:date>2023-09-29T12:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch wich layers in a map service are used in a web map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333725#M9079</link>
      <description>&lt;P&gt;To get that information, you can take a look at the item data.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

conn = GIS("https://machine.domain.com/portal", "admin", "password")
item = conn.content.get(&amp;lt;itemID&amp;gt;)
item_data = item.get_data()
# Include the below line for prettified JSON
print(json.dumps(item_data, indent=4, sort_keys=True))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In your case, the information you're looking for will be in:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;item_data["operationalLayers"]&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 13:36:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333725#M9079</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2023-09-29T13:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: Fetch wich layers in a map service are used in a web map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333951#M9081</link>
      <description>&lt;P&gt;If you need to perform this action on a large number of web maps and possibly web apps, I would suggest looking at GeoJobe Admin tools as I think they are a great investment and are designed to perform tasks like this without having to do your own code development.&lt;/P&gt;</description>
      <pubDate>Sat, 30 Sep 2023 14:45:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/fetch-wich-layers-in-a-map-service-are-used-in-a/m-p/1333951#M9081</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2023-09-30T14:45:58Z</dc:date>
    </item>
  </channel>
</rss>

