Possible to find out where feature layers are being used in web applications?

13920
41
Jump to solution
02-09-2022 08:12 AM
ZachRobinson_SantaClaraCounty
New Contributor II

I am wondering if it is possible to easily find out which web applications in our ArcGIS Online organization are using a specific feature layer.

For example, if I delete a layer from our organization, I want to make sure I know which web maps and applications the deletion will affect. This can be difficult and tedious to search manually when an organization has many web maps and applications. 

41 Replies
OnnoKeller
New Contributor

This looks really great! I am new  to python scripts though and when trying to run the tool I get an error message:

OnnoKeller_0-1681389259027.png

 

Any help on how to resolve this error would be much appreciated!

It should be noted that my maps and feature layers are in ArcGIS Online and not portal...

 

 

 

0 Kudos
jcarlson
MVP Esteemed Contributor

The API should work the same regardless of where you're searching.

Try replacing line 1 with import arcgis

Then replace line 5 with gis = arcgis.gis.GIS('home')

- Josh Carlson
Kendall County GIS
OnnoKeller
New Contributor

Thanks for the quick reply and help.

Your proposed changes made the script work for me!

0 Kudos
MatthewBeal
Occasional Contributor III

Katherine, 

Thank you for sharing this! It is very helpful! How long on average does it take for it to search for Web Applications for you? We have a relatively small AGOL org (<500 items) and yet it still took the tool 3.5 hours to run. The Web maps part finishes in less than a minute. I'm not sure if I've misconfigured something or if there is sosmething weird about our organization that I'm not aware of but this is a real head scratcher. 

0 Kudos
AriLukas
Occasional Contributor

Hello Katherine, 

 

I realize this is an old post but i was hoping you might clarify something for me.

 

I have used it successfully to find what what Web Maps are being used but when I use it to try to find Applications I did not get any results (when i know I should). I saw in your post you showed a web map example, have you successfully been able to find apps as well? If so you, do you know what may be causing me not to find ID in any app? 

 

Thank you for all the time and effort you have put into this script

 

Best, 

Ari

0 Kudos
Katie_Clark
MVP Regular Contributor

Hi @AriLukas , I just tested using the ID of a hosted feature layer that I knew was in a web app (made with web app builder) and it worked for me. What is the exact type of application that you know the layer is in? (dashboard, instant app, etc.)

Best,
Katie


“The goal is not simply to ‘work hard, play hard.’ The goal is to make our work and our play indistinguishable.”
- Simon Sinek
0 Kudos
Jaime_Carlino
New Contributor II

Hi Ari, I am experiencing the same issue. Did you ever find a solution to no output for web apps when you know you should?

0 Kudos
Big-Chill
New Contributor III

Thanks so much for this.  However, it does not catch items being utilized by a Web Experience.  You will need to add this (apply code where necessary).  Again, this is great stuff

# Pull list of all web experience apps
webexp = gis.content.search('', item_type='Web Experience', max_items=-1)

exp_list = []

# Check each web experience app for matches
for wx in webexp:  
    try:
        # Get the JSON as a string
        wxdata = str(wx.get_data())

        criteria = [
            wxdata.find(find_url) > -1, # Check if URL is directly referenced
            any([wxdata.find(i) > -1 for i in matches]) # Check if any matching maps are in app
        ]

        # If layer is referenced directly or indirectly, append app to list
        if any(criteria):
            exp_list.append(wx)
    
    # Some apps don't have data, so we'll just skip them if they throw a TypeError
    except:
        continue

s1 = pd.DataFrame([{'title':a.title, 'id':a.id, 'type':a.type} for a in app_list])
s2 = pd.DataFrame([{'title':b.title, 'id':b.id, 'type':b.type} for b in exp_list])

# Concatenate with original DataFrame
pd.concat([s1, s2])

 

TobyStewart2
New Contributor II

Thanks this is all awesome. Can I ask how would you add your script to the original one so that it will check all three types?

0 Kudos
by Anonymous User
Not applicable

Thank you to the contributors on this thread.  I've got the script running in ArcGIS Pro toolbox but after 5-6 minutes I get a message;

"TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond"

I am logged into ArcGIS Pro with my AGOL user account and I am testing the script using an item I "own" so it shouldn't be a security issue.

I've done some online research and a lot of people are suggesting it could be a firewall issue and I will need to alter my network settings.  I'd hate to get messing around with my firewall or network settings as our IT department would likely frown on that.

Anyone else encounter this issue? 

Tags (1)
0 Kudos