Find Layer in Portal Service

938
2
Jump to solution
06-01-2021 03:37 AM
Labels (2)
DeanHowell1
Occasional Contributor III

We have an ArcGIS Online layer that is being referenced in one of our portal maps and causing issues but I can't find which map / app / service is using the ArcGIS Online Layer? 

I can see the name of the ArcGIS Online layer in the logs but can't see which app / map / service is using it.

Is there a way to find this layer in our portal?

 

 

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Frequent Contributor

I might loop through all the webmaps and look for the url string in the layers of the webmaps.

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

feature_url = 'url of the service you want to find'

#connect to your portal
gis = GIS(url, username, password)

#get all the webmaps in the portal
search_result = gis.content.search(query="", item_type="Web Map", max_items=1000)

#loop thru all the search items, turn them into webmap objects
for item in search_result:
    wm = WebMap(item)
    for layer in wm.layers:
        if feature_url in layer["url"]:
            print('title:'
            print(item.title)
            print'url:'
            print(layer["url"])
            print('\n')

View solution in original post

2 Replies
DavidPike
MVP Frequent Contributor

I might loop through all the webmaps and look for the url string in the layers of the webmaps.

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

feature_url = 'url of the service you want to find'

#connect to your portal
gis = GIS(url, username, password)

#get all the webmaps in the portal
search_result = gis.content.search(query="", item_type="Web Map", max_items=1000)

#loop thru all the search items, turn them into webmap objects
for item in search_result:
    wm = WebMap(item)
    for layer in wm.layers:
        if feature_url in layer["url"]:
            print('title:'
            print(item.title)
            print'url:'
            print(layer["url"])
            print('\n')
DeanHowell1
Occasional Contributor III

Thanks @DavidPike , I appreciate you taking the time to put the script together and will give it a go to try and find the culprit. 

Just adding an additional thanks as the script option worked but it would be great if there were an option to search within Portal somewhere to achieve the same result.