Is there a way to report on maps and apps are using a service?

380
1
06-01-2021 06:31 PM
DerekPhyn
Occasional Contributor

Does anyone know if there is a tool that can generate a report of what webmaps and apps use a selected layer/service? Something that works both for enterprise portal and ArcGIS Online? I have tried qonda, ArcGIS Online Assistant, and Admin Tools for ArcGIS Online to no avail. Surely there must be something out there?

0 Kudos
1 Reply
jcarlson
MVP Frequent Contributor

In Enterprise, there are properties dependent_to and dependent_upon, which are, sadly, not available in AGOL just yet.

However, you can manually loop through your web maps and look for those dependencies in a Python Notebook. If you know the itemID of the service(s) you want to look up, you can use something like the code below:

from arcgis.gis import GIS
from arcgis.mapping import WebMap

service_ids = ['list', 'of', 'itemIDs']

webmaps = gis.content.search('', item_type='Web Map', max_items=-1)

map_list = []

for w in webmaps:
    wm = WebMap(w)
    for b in wm.basemap.baseMapLayers:
        try:
            b.itemId
        except AttributeError:
            continue
        else:
            if b.itemId in service_ids:
                map_list.append(w)
                
    for l in wm.layers:
        try:
            l.itemId
        except AttributeError:
            continue
        else:
            if l.itemId in service_ids:
                map_list.append(w)

 

This will look at each layer in each web map, adding the web map to the map_list list if any of the layers match the input itemID(s).

- Josh Carlson
Kendall County GIS