Select to view content in your preferred language

Cloning ArcGIS StoryMaps

8149
18
06-17-2020 11:27 AM
PeterKnoop
MVP Regular Contributor
12 18 8,149

The April 2020 ArcGIS StoryMap update introduced a helpful "Duplicate story" capability, however, it only supports a "partial clone" of a StoryMap. In other words, it duplicates the direct content of the StoryMap itself, but not any of the referenced content, such as Web Maps and Web Scenes embedded in the StoryMap, and the Feature Layers referenced by those.

 

I often find myself needing to create a "full" clone of a StoryMap, including any referenced content the user also created. The goal being for the person who created the StoryMap to keep a copy for themselves, under their control, while they also need to provide a copy of the StoryMap to someone else, who will then have control over the copy. Sometimes the copy also needs to be made to a different ArcGIS Online organization than where the original is hosted.

 

While I am hopeful that Esri will directly address this need soon, in the meantime, below is a link to a Notebook created to handle cloning ArcGIS StoryMaps (not the Classic Story Map Apps). It relies on the powerful clone_items() method in the ArcGIS API for Python.

 

Thumbnails of cloned ArcGIS StoryMaps.

 

By "full" clone, I mean copying or replicating not only the StoryMap itself, but also cloning any referenced content in the StoryMap that is owned by the same user as owns the StoryMap. Cloning referenced content is supported in the Notebook for the common content types (images, express maps, web maps, web scenes, feature layers, etc.) In the case of unsupported content types, the reference to the original item is carried through to the cloned StoryMap. Similarly for referenced content that is not owned by the same user as the StoryMap, the reference to the original item will be maintained in the clone.

 

In Education, the need for a cloned StoryMap often comes up in the context of class assignments. The instructor needs a copy-of-record for grading purposes, which the student can not edit after the assignment is due. (You can also automate all of this with your LMS, so that clones are made automatically when assignments are submitted or due.) Meanwhile, the student wants to keep a copy of their work to perhaps continue to improve upon it, and to show off their GIS skills to prospective employers or graduate schools.

 

Another common use case in Education is collaborative work. A student might work with a faculty member to create a StoryMap to help with disseminating the faculty member's research, or a student might create a StoryMap for a client as part of a service learning experience. In those cases the student again often would like to maintain control over a copy of their work to show off their skills, while the faculty member or client needs to have a copy of the final product over which they have control going forward. And, in the case of service learning, the student may create the StoryMap on their institution's ArcGIS Online organization, and the clone needs to live on the client's ArcGIS Online organization.

 

The Notebook shared below handles cloning of StoryMaps both within and between ArcGIS Online organizations, assuming you have the appropriate privileges. It can also handle copying StoryMaps from public ArcGIS Online accounts to organizational ones, for when a student accidentally creates work there, without realizing they have an account through their institution. 

 

It also handles cloning most of the common types of ArcGIS Online content that can be incorporated into ArcGIS StoryMaps, such as Web Maps and Web Scenes, and their underlying Feature Layers. Please keep in mind, however, that it does not handle all possibilities. So keep your eye out for warnings and errors in the Notebook's output cells, which are there to help guide you in determining if it is safe to proceed, and if you will likely end up with the "full" clone of a StoryMap you were expecting.

 

Also, there is no documentation for the ArcGIS StoryMap format, so Notebook depends on some reverse-engineering. Future updates to ArcGIS StoryMaps may not be compatible with assumptions about the format made this Notebook, thereby breaking the Notebook. Esri, however, nicely provides a format version to track in the typeKeywords, so the Notebook will potentially detect version-related issues, and provide you with a warning.

 

If you've read this far, here's the Notebook: Clone ArcGIS StoryMap.

 

I hope you find it useful...

18 Comments
JoeBorgione
MVP Emeritus

Great stuff Peter!  Thanks for sharing!

OwenGeo
Esri Notable Contributor

Excellent workPeter Knoop!! We've been hoping a member of our storytelling community would write a script or notebook to do this, so thank you for your efforts and attention to detail. I haven't personally tested this yet, but your write up and associated story is great and appears to cover many of the nuances.

Note that we are planning some tools to help developers work with ArcGIS StoryMaps, so look out for those next year.

PeterKnoop
MVP Regular Contributor

Thanks, Owen Evans‌. I look forward to checking out the new tools!  (Love to see the ability to convert or Save As a classic Cascade StoryMap as an ArcGIS StoryMap; that's our next most common challenge, however, it likely won't be a long-term one, as most of our community of users are creating new stories in the latter these days.)

KelleeKoenig1
Regular Contributor

Just wanted to add my thanks for sharing this resource! Another team at my organization had an intern create a StoryMap for them that I learned after the fact was created using their student account. Thanks to your Notebook (and their university's admin) we were able to create an in-house copy so the team could make edits beyond the internship. A real time-saver!

msa4012
Occasional Contributor

Hi,

It is giving me this error:

 

Login error.
 
---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
In  [49]:
Line 2:     target_gis = gis_login(portal_url=target_portal_url, username=tagert_username, password=target_password, use_builtin=target_use_builtin)

In  [47]:
Line 28:    return(gis)

UnboundLocalError: local variable 'gis' referenced before assignment
---------------------------------------------------------------------------
I am putting in my Organization's URL which uses SAML auth to sign in. Can you please let me know,

Thanks,
Madhuri.
PeterKnoop
MVP Regular Contributor

@msa4012 the Notebook assumes you are using ArcGIS built-in accounts for simplicity. I've added a note to make that clearer. 

For enterprise accounts, like those using SAML or ADFS, you need to modify the code making the connection to match your GIS systems' requirements. 

For an overview of using different authentication schemes with the ArcGIS API for Python, please see Working with different authentication schemes, find one that matches your setup, and use it to replace the connection code in the Notebook for your source and/or target GIS systems.

Hope that gets you back on track!

msa4012
Occasional Contributor

Thank you very much! The article helped!!

HarrisonBloom1
New Contributor

Hi,

Is there a reason why the error message below would be thrown? The tool is successfully accessing the storymap and showing the owner username which is entered in the next line. Any guidance would be greatly appreciated!

HarrisonBloom1_0-1617925725712.png

 

PeterKnoop
MVP Regular Contributor

@HarrisonBloom1The original code in the cell, source_user = storymap_item['owner'], retrieves the owner of the storymap from the "owner" property of the storymap item. It determines what the right value is and sets it for you. If you restore the original code, then it should work.

The only place in the Notebook in which you need to edit code is the "Provide Information for Cloning" section. The rest should run fine as-is.
 
Hope that helps.
OwenGeo
Esri Notable Contributor

@PeterKnoop -- The recent 1.9 release of the ArcGIS API for Python added some new capabilities that help clone StoryMaps. I'm not sure if your script can be simplified/updated to utilize these tools, but thought you'd like to know if you hadn't heard this already.

For more info see Copying an ArcGIS StoryMap item to another organization | ArcGIS Developer.

Ade_Bruijn
Regular Contributor

Thanks Peter! It worked well. Had trouble at first to find out how to start the notebook and choose the different runtime. I'm not familiar with notebooks. Turned out to be piece of cake. Upload in contents and Item details, settings, choose the right runtime.

AmyNewsam
Regular Contributor

Update: Yes, there is!  I just found the link to the new, beta ArcGIS Online Assistant, where I successfully copied a storymap from my organizational account to a public account.

Original post:  Is there still no easier way for an administrator to copy students' content over to a public account?

C-Stevens
Occasional Contributor

Hi @PeterKnoop ! 

This is awesome! After about 2 days of troubleshooting (PEBKAC issues with virtual envs), I managed to clone my StoryMap using ArcGIS API version 1.7.0 (telling miniconda to install it as much with [conda install -c esri arcgis==1.7]).

I tried executing it with API version 2.0.1 but the code chunk below "Clone StoryMap. The last thing that needs to be cloned is the StoryMap itself" was not happening. After 10 minutes of waiting for it to execute, I terminated the session - this happened twice. I then changed my API version to 1.7.0 and was successful with minor bugs - the StoryMap cloned itself about 12 times into my account, and the webmap it contained was also cloned 12 times into my ArcGIS Content. Unsure why the excessive cloning happened! Perhaps the 2.0.1 cloning was successful, but not noted in the jupyter session? 

PeterKnoop
MVP Regular Contributor

@C-Stevens I suspect you are correct, in that the extra copies were created during those attempts with 2.0.1. Not sure what changed in the latest version to break cloning, however, glad to hear you were able to use an earlier version to achieve what you needed. I will see if I can figure out what has gone wrong with 2.0.1.

PeterKnoop
MVP Regular Contributor

@AmyNewsamthe wonderful ArcGIS Assistant is a much simpler solution when your are only interested in copying the StoryMap itself.

If your story includes referenced content you have created, such as a web map and hosted feature layers for the web map, which you also want to copy, then the Notebook described here may save you some time. You can, however, achieve the same goal as the Notebook by using the Assistant to manually copy the story and copy the referenced content, and then swizzle the references in the copied story to point to the copied content.

PeterKnoop
MVP Regular Contributor

Looks like version 2.0.1 of the ArcGIS API for Python still has the issue where clone_items() creates endless clones of the StoryMap until you manually kill the kernel. (BUG-000146244 indicates the issue was fixed at version 2.0.1, however, the issue can still be reproduced.)

For now, if you use the Notebook referenced here, make sure you are using an older version of the API, such as 1.8.4, or for Online Notebooks use the runtime ArcGIS Notebook Python 3 Standard - 5.0.

I would also recommend taking a look at the Esri sample Notebook, Copying an ArcGIS StoryMap item to another organization, as it illustrates how to copy a StoryMap without using clone_items(). Note, however, that it does not limit what referenced content is also copied in the same way as the Notebook referenced here is configured to do.

laurenarmstrong13
New Contributor

I successfully cloned a StoryMap! Now, if I was to delete the notebook and feature layer used to make the cloned StoryMap from My Content, will that affect the StoryMap in any way? Or is that now created and completely independent from the notebook and feature layer?

PeterKnoop
MVP Regular Contributor

@laurenarmstrong13, if the notebook was successful, then you should be able to delete your copy of the notebook and any original content that was cloned, which you no longer need. I would, however, suggest thoroughly testing your cloned StoryMap to make sure it works as expected before you delete anything. For example, if your original content was shared publicly, and you have shared your cloned content publicly, then you could unshare the original content, and then open your cloned StoryMap in an incognito or private browser window to verify that it is all there.

About the Author
University of Michigan IT Advocate, GIS Evangelist, Cloud-Computing Champion, AR/MR/VR/XR Visionary, Software Poet, and paleoceanographer/geologist.