As authors, we find ourselves crafting stories from a growing collection of content within ArcGIS Online. As we weave together layers, maps, and apps into stories, it can become a challenge to decipher which layer appeared in that map, which map was used in that story, and which apps were embedded in that story.
Our team has been working on a Python script (available here) to tackle this problem. This script helps reveal the relationships between items within your organization, enabling you to better understand how layers, maps, apps, and stories are connected.
This tool helps you understand how items, such as stories, dashboards, maps, layers, and surveys, are connected across your ArcGIS Online content, allowing you to:
This notebook uses the ArcGIS API for Python to query the items in your organization. As it explores the results, the script sifts through each item's JSON and identifies the item ids referenced within. It then builds a list of these relationships between items and constructs a graph that can be used to visualize your content as a network of connected items.
This simplified example demonstrates how the connection between items can be visualized in a graph network.
To get started and run this script to discover content in your organization, you need to configure just a few parameters.
1. Download and setup the script: Download the Python script from the link below.
Due to the nature of the recursive search, it could time out when run from an ArcGIS Notebook. Therefore, it is recommended that the script be downloaded and run locally.
2. If running on a local machine without an ArcGIS Pro installation, install the ArcGIS API for Python
3. Update the script arguments
# PARAMETERS
# Portal to investigate
PORTAL = "https://www.arcgis.com"
# Username to log in to the portal
USERNAME = "<USERNAME>"
# Password associated with the portal
PASSWORD = "<PASSWORD>"
# Output CSV file location
OUTPUT_FILE = "related_items.csv"
# Location for CSV where missed items and error messages will be added
OUTPUT_MISS_FILE = "missed_items.csv"
# Location of graphing html file. Will only output when CREATE_GRAPH_HTML is True
GRAPH_FILE = "graph.html"
# Should data be graphed at the end of the process
CREATE_GRAPH_HTML = True
# Unix timestamp (in milliseconds) marking the starting point for the search algorithm. Default is 00:00:00, January 1st, 2016
QUERY_START_DATE = 1451624400000
# The name of the account to be analyzed. If left blank the script will use the logged in user.
ACCOUNT = "<USERNAME>"
# Max number of items to analyze. FOR dev/testing purposes. Modify this value to an integer if you want to test this script with a shortened run
TEST_MAX_PROCESSED_ITEMS = None
# Max number of items to find.. FOR dev/testing purposes. Modify this value to an integer if you want to test this script with a shortened run
TEST_MAX_FOUND_ITEMS = None
net = Network(notebook=False, select_menu=True, filter_menu=True)
4. Run the script
5. Exploring the results: The tool creates several outputs that can be further explored.
This pivot table demonstrates how the output 'related_items.csv' can be used to inventory items like stories and web maps, but also the content within those items or related to those items.
We hope this Python notebook helps you better manage and understand the connections within your ArcGIS Online content. We’d love to hear how you’re using this tool and any insights you’ve gained from it. Feel free to share your experiences, suggestions, or any creative ways you’ve adapted it to fit your workflow!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.