Customize a story using Python

Learn how to customize an existing in using Python.

LA parks and trails story created with ArcGIS StoryMaps

The ArcGIS API for Python provides a set of tools and functionalities to interact with , , and ArcGIS StoryMaps.

In this tutorial, you use the StoryMap object to update the title and summary of a story and share it publicly.

Prerequisites

Steps

1. Install the ArcGIS API for Python

If you have not done this, you will need to install the ArcGIS API for Python library. You can do this by running the following command in your Python environment:

1
pip install arcgis

If you have Python 3.x.x installed, run the following command:

1
pip3 install arcgis

2. Authenticate and connect to ArcGIS Online

To access and customize your ArcGIS StoryMaps, you need to authenticate and connect to your ArcGIS Online account. You can do this by creating an instance of the GIS class and providing your login credentials:

1
2
3
4
from arcgis.gis import GIS

# Create a GIS object and authenticate
gis = GIS("https://www.arcgis.com", "username", "password")

3. Retrieve and modify a story

Once you are connected, you can retrieve a story by its ID or search for it using specific criteria. For example, to retrieve a story by its ID:

1
2
3
# Retrieve a story by its ID
storymap_id = "your_storymap_id"
storymap = gis.content.get(storymap_id)

4. Customize the story

You can customize various aspects of the story, such as its title, summary, cover image, layout, and content. Here is an example of updating the title and summary:

1
2
3
4
5
# Update the title and summary of the story
new_title = "New Title"
new_summary = "This is a customized story created using Python."

storymap.update(item_properties={'title': new_title, 'snippet': new_summary})

You can explore the item_properties dictionary to see other available properties you can modify.

5. Save and publish the changes

After making the desired modifications, you need to save and publish the changes to apply them to the story:

1
2
3
# Save and publish the changes
storymap.save()
storymap.share(everyone=True)  # Optionally, make the story public

You can adjust the sharing settings according to your requirements.

These are the basic instructions to get started with customizing ArcGIS StoryMaps using ArcGIS API for Python. Please refer to the Python API documentation for more detailed information and examples to help you further explore and utilize its capabilities.

Tutorials

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close