Select to view content in your preferred language

Protecting your stories, maps, and layers from accidental deletion

508
2
03-03-2025 05:38 AM
Warren_Davison
Esri Contributor
5 2 508

Have you ever deleted a map or layer in ArcGIS Online, only to discover that it was used in one of your stories? I have. It has happened more times than I’d like to admit. In my effort to declutter, I sometimes accidentally delete vital elements—like a layer, map, or app—on which my stories rely. This led to disastrous consequences before the recycle bin was implemented, forcing me to recreate content multiple times. These days, deleted items can be restored from the trash bin, but wouldn’t it be better if there was a way to stop them from being deleted at all?

Motivated by my numerous mistakes and finally ready to demonstrate that I had learned from them, I created an ArcGIS Notebook to address my issue. Using the ArcGIS API for Python, this notebook scans a story's content to identify layers, maps, dashboards, and other items that are referenced by the story and applies delete protection to them. This helps ensure that they aren’t accidentally deleted.

In addition, it can also be configured to update the sharing settings of the items discovered within the story. This feature catches all the embedded dashboards, surveys, and experiences that might go unnoticed until a reader is prompted to sign into ArcGIS to view elements of your story, which is never a great reading experience (I’m also guilty of this).

Protecting your stories

Running this handy utility script is straightforward. Provided you have the necessary user permissions to run a notebook, it can be run from within ArcGIS Online via the shared ArcGIS Notebook. While initially designed to safeguard the maps and layers within a story, it can also be pointed at other item types, such as maps and apps, to protect their components from accidental deletion. If you want to make additional customizations to the script or run it on your local machine, you can download it here.

To get started you’ll simply need to follow the directions included in the notebook and update the following parameters in the first code cell.

 

## Notebook parameters
story_id = '{itemId}' ## paste the itemId of the story you’d like to protect here.
delete_protect = True | False ## indicate whether you would like to enable delete protection on the discovered items using ‘True’ or remove delete protection using ‘False’.
share = True | False ## indicate whether you would like to share the discovered items using ‘True’ or not change the sharing level on the items by setting ‘False’.
share_level = 'private', 'org', 'public' ## when the ‘share’ is set to ‘True’ specify which level to share the items at. Options are ‘private’, ‘org’, or ‘public’.

 

Once these parameters are configured, you’re all set! You can now run the notebook. The notebook provides helpful descriptions of what each cell is doing and what to expect when it runs, but I suggest running each cell up to and including the ‘Protect the items’ cell. This cell performs the delete protection and sharing. Once it’s complete, wait a moment before running the following cell. This next ‘Review the results’ cell will re-query the items and return a table indicating their new delete protection and sharing level.

Go forth and delete protect!

This new ArcGIS Notebook should simplify the preservation of your stories and their content that much easier. This helps to ensure your readers have the best experience possible while reading your story. Let us know if there are any other ways you’re using ArcGIS Notebooks to manage your stories or whether there are other script utilities you’d like to see for ArcGIS StoryMaps.

2 Comments
Contributors
About the Author
I specialize in creating engaging maps and graphics that tell immersive, place-based stories. Based in Kitchener, Canada, I work with Esri’s StoryMaps team, where I enjoy sharing the creative process behind each project. When I'm not exploring vectors and pixels, you’ll likely find me cycling around town with my kids along for the ride.