diff --git a/guide/13-managing-arcgis-applications/storymap-collection.ipynb b/guide/13-managing-arcgis-applications/storymap-collection.ipynb new file mode 100644 index 0000000000..f9bc04f7a7 --- /dev/null +++ b/guide/13-managing-arcgis-applications/storymap-collection.ipynb @@ -0,0 +1,912 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "865358ac-ba81-48e4-80bb-7a3bc87a0d06", + "metadata": {}, + "source": [ + "## Introduction to Collections (ArcGIS StoryMaps)\n", + "\n", + "ArcGIS StoryMaps offers a capability that allows you to assemble collections, which are sets of ArcGIS StoryMaps items bundled for sharing. [Collections](https://storymaps.arcgis.com/collections/d34681ac0d1a417894a3a3d955c6913f?item=13) can include your own stories as well as stories authored by others. Other items such as ArcGIS apps, media, and files can also be added to a collection as supporting content.\n", + "\n", + "You can use collections in a variety of ways, such as telling a longer story in installments or chapters; gathering stories, apps, and items that share a common theme; or creating a portfolio of your work." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "ee71cbbb-2b96-452e-abc7-4015bf64f001", + "metadata": {}, + "outputs": [], + "source": [ + "from arcgis.gis import GIS\n", + "from arcgis.apps.storymap import Collection, Themes\n", + "from arcgis.apps.storymap.story_content import Image" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "95617c82-c0ec-47e8-a57e-4ef1daaee57f", + "metadata": {}, + "outputs": [], + "source": [ + "gis = GIS(profile='your_online_profile')" + ] + }, + { + "cell_type": "markdown", + "id": "2dd97b19-1f26-49c5-91f4-bcb33dc96b5e", + "metadata": {}, + "source": [ + "We start by creating a `Collection` and adding content to it." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "6960f277-6104-4a38-a39e-990a50862ca5", + "metadata": {}, + "outputs": [], + "source": [ + "my_collection = Collection()" + ] + }, + { + "cell_type": "markdown", + "id": "74b1a996-c7dc-4231-bc7a-6972c19649a3", + "metadata": {}, + "source": [ + "### Add content to the Collection" + ] + }, + { + "cell_type": "markdown", + "id": "06cfefb0-ca0f-4741-a9be-b92e26a74be6", + "metadata": {}, + "source": [ + "#### 1. StoryMap\n", + "\n", + "We start by adding a StoryMap item." + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "2d62023b-1a03-4233-88b8-1b6fdf730228", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature Themed Story\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: January 23, 2026\n", + "
0 comments, 1 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "storymap_item = gis.content.get('7860d45d35f6455193576933206d8352')\n", + "storymap_item" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "8804ee54-f7fd-4195-8b62-eb3d7fba6c2c", + "metadata": {}, + "outputs": [], + "source": [ + "my_collection.add(storymap_item)" + ] + }, + { + "cell_type": "markdown", + "id": "d0b6b7d8-70d7-44d3-a513-73507576d74c", + "metadata": {}, + "source": [ + "#### 2. Briefing" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "bdfe801f-1150-48f9-b921-16c4c8d02c72", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature themed Briefing slides\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: January 23, 2026\n", + "
0 comments, 5 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "briefing_item = gis.content.get('af0ff7bd06d046b3b7b3344c78eecb4f')\n", + "briefing_item" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "18f6ea90-e4e6-438f-9da9-136db28f8bcc", + "metadata": {}, + "outputs": [], + "source": [ + "my_collection.add(briefing_item)" + ] + }, + { + "cell_type": "markdown", + "id": "648e3ad0-87cb-4521-bb42-6fe3ddad8b01", + "metadata": {}, + "source": [ + "#### 3. Map " + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "ca354c98-5a18-4f4a-a9d7-d73f0944b9d9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature WebMap\n", + " \n", + "
A Map for the Nature StoryMap
Web Map by MMajumdar_geosaurus\n", + "
Last Modified: January 23, 2026\n", + "
0 comments, 15 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "map_item = gis.content.get('7f39672ef7f6469db7b2bbd383349fc1')\n", + "map_item" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "e70faf70-761b-4bb0-aafc-840e4ff40ca0", + "metadata": {}, + "outputs": [], + "source": [ + "my_collection.add(map_item)" + ] + }, + { + "cell_type": "markdown", + "id": "9725960d-1bc8-44e9-a831-d8dd961cc440", + "metadata": {}, + "source": [ + "#### 4. Web Experience app" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "45c0dcd0-5d45-4573-83ea-f696cf99f8a6", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Capitals and time zones\n", + " \n", + "

Web Experience by MMajumdar_geosaurus\n", + "
Last Modified: March 12, 2025\n", + "
0 comments, 9 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_experience = gis.content.get('717f06e4e65c432a866e12c86a7505f3')\n", + "my_experience" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "b5c1e307-0aa4-409e-b5fd-313ddfb02c70", + "metadata": {}, + "outputs": [], + "source": [ + "my_collection.add(my_experience)" + ] + }, + { + "cell_type": "markdown", + "id": "6e7bb969-3a78-4df1-919a-b2848d0a42b7", + "metadata": {}, + "source": [ + "#### Editing the Cover of the Collection\n", + "\n", + "Now that we have added relevant content items to our Collection, we can edit the cover of our Collection.\n", + "\n", + "The cover is what you see at the start of your Collection and sets the visual tone. The cover will always be the first `content` element (index = 0) of a Collection.\n", + "\n", + "We will start by defining the `Image` we would like on the cover of this Collection." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "76cc8637-ae0a-4061-955a-475da60993a9", + "metadata": {}, + "outputs": [], + "source": [ + "img = Image(\"https://www.nps.gov/npgallery/GetAsset/69680c29-caa3-42da-93d9-32925e9ed409/proxy/hires\")" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "7b74641f-69a5-4cce-ac99-0409057b7eab", + "metadata": {}, + "outputs": [], + "source": [ + "cover = my_collection.content[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "e75ed658-723d-4d18-928e-b8886865980f", + "metadata": {}, + "outputs": [], + "source": [ + "cover.title = \"Nature Collection\"\n", + "cover.summary = \"Nature themed items for ArcGIS StoryMaps\"\n", + "cover.byline = \"Python Collection\"\n", + "cover.media = img" + ] + }, + { + "cell_type": "markdown", + "id": "82b4047d-a20a-45bd-8048-ba8a93a3e4e1", + "metadata": {}, + "source": [ + "### Save the collection\n", + "\n", + "While we are demonstrating the process to programmatically [`save()`](https://developers.arcgis.com/python/latest/api-reference/arcgis.apps.storymap.html#arcgis.apps.storymap.collection.Collection.save) the Collection below, it is strongly encouraged to view and verify the Collection in the UI before you publish it, especially for the first time you are publishing a Collection. " + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "e67ba426-863a-41c0-bb8b-0ea790beec00", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature Collection\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: February 06, 2026\n", + "
0 comments, 0 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.save(title = \"Nature Collection\", tags = \"Python\", access = \"private\")" + ] + }, + { + "cell_type": "markdown", + "id": "ba026ceb-c3d7-455e-92d7-ff07d3154139", + "metadata": {}, + "source": [ + "![collection](https://github.com/user-attachments/assets/304d6643-ee82-413a-a688-5a9c1dd66eb8)" + ] + }, + { + "cell_type": "markdown", + "id": "b45f92c2-633f-4121-b4c6-9e32d2ec4df3", + "metadata": {}, + "source": [ + "### View content of Collection\n", + "\n", + "You can view the contents of a `Collection` as a list and a table using the `content` and `content_info` properties respectively. " + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "2ef64896-1f4c-45ba-af64-ac27a4abd509", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Cover(),\n", + " CollectionNavigation(),\n", + " ,\n", + " ,\n", + " ,\n", + " ]" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.content" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "e25b6a65-9448-42e9-b457-b05a7084474b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
TypeInstanceVisibilityLocation
0StoryMap{'id': '7860d45d35f6455193576933206d8352', 'ow...True[]
1StoryMap{'id': 'af0ff7bd06d046b3b7b3344c78eecb4f', 'ow...True[]
2Web Map{'id': '7f39672ef7f6469db7b2bbd383349fc1', 'ow...True[]
3Web Experience{'id': '717f06e4e65c432a866e12c86a7505f3', 'ow...True[]
\n", + "
" + ], + "text/plain": [ + " Type Instance \\\n", + "0 StoryMap {'id': '7860d45d35f6455193576933206d8352', 'ow... \n", + "1 StoryMap {'id': 'af0ff7bd06d046b3b7b3344c78eecb4f', 'ow... \n", + "2 Web Map {'id': '7f39672ef7f6469db7b2bbd383349fc1', 'ow... \n", + "3 Web Experience {'id': '717f06e4e65c432a866e12c86a7505f3', 'ow... \n", + "\n", + " Visibility Location \n", + "0 True [] \n", + "1 True [] \n", + "2 True [] \n", + "3 True [] " + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.content_info" + ] + }, + { + "cell_type": "markdown", + "id": "5c2a95e1-e052-44a3-8113-6d07c852d3f7", + "metadata": {}, + "source": [ + "You can also update the visibility of a particular content item in the Collection using the [`update_content_info()`](https://developers.arcgis.com/python/latest/api-reference/arcgis.apps.storymap.html#arcgis.apps.storymap.collection.Collection.update_content_info) method.\n", + "\n", + "E.g., the `Web Experience` item is still work in progress and we can hide it. " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "2a6f346b-524c-48fa-ad5d-f7a8450a0fb5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
TypeInstanceVisibilityLocation
0StoryMap{'id': '7860d45d35f6455193576933206d8352', 'ow...True[]
1StoryMap{'id': 'af0ff7bd06d046b3b7b3344c78eecb4f', 'ow...True[]
2Web Map{'id': '7f39672ef7f6469db7b2bbd383349fc1', 'ow...True[]
3Web Experience{'id': '717f06e4e65c432a866e12c86a7505f3', 'ow...False[]
\n", + "
" + ], + "text/plain": [ + " Type Instance \\\n", + "0 StoryMap {'id': '7860d45d35f6455193576933206d8352', 'ow... \n", + "1 StoryMap {'id': 'af0ff7bd06d046b3b7b3344c78eecb4f', 'ow... \n", + "2 Web Map {'id': '7f39672ef7f6469db7b2bbd383349fc1', 'ow... \n", + "3 Web Experience {'id': '717f06e4e65c432a866e12c86a7505f3', 'ow... \n", + "\n", + " Visibility Location \n", + "0 True [] \n", + "1 True [] \n", + "2 True [] \n", + "3 False [] " + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.update_content_info(index = 3, visible = False)" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "4bb4397a-04b9-486c-9ae4-3c75a92a62a9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature Collection\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: February 06, 2026\n", + "
0 comments, 1 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.save()" + ] + }, + { + "cell_type": "markdown", + "id": "33fbc420-6073-4527-83ee-cdbb810530e1", + "metadata": {}, + "source": [ + "We now see in the Edit mode that the `Web Experience` app is hidden.\n", + "\n", + "![visible](https://github.com/user-attachments/assets/f06bfde2-03c5-4d55-8d9c-ee86482bb43d)" + ] + }, + { + "cell_type": "markdown", + "id": "313a2805-61a8-4b0c-ab2b-42faef36671e", + "metadata": {}, + "source": [ + "### Remove an item from the Collection\n", + "\n", + "We can remove an item by passing the item's index to the `remove()` function. Let us remove the Web Experience app from Collection. " + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "a7321330-1d06-4b33-b1d1-163e0aa0e2d8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.remove(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "253b41b3-dd33-44ec-8a9e-8db96273d71b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[Cover(),\n", + " CollectionNavigation(),\n", + " ,\n", + " ,\n", + " ]" + ] + }, + "execution_count": 24, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.content" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "423e654a-1cf9-4b38-bfee-ea55c41a176e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature Collection\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: February 06, 2026\n", + "
0 comments, 1 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.save()" + ] + }, + { + "cell_type": "markdown", + "id": "27c680d4-08ad-4df0-9caf-bcc26d6551de", + "metadata": {}, + "source": [ + "![deleted](https://github.com/user-attachments/assets/9261f093-b186-4063-b01f-e637b24f04c1)" + ] + }, + { + "cell_type": "markdown", + "id": "c00dfde9-0a53-4553-ae02-0cd3cb62df83", + "metadata": {}, + "source": [ + "### Update theme of the Collection\n", + "\n", + "Theme sets the visual style and appearance of the Collection. ArcGIS StoryMaps supports the following themes:\n", + "\n", + "![themes](https://github.com/user-attachments/assets/8f1cc448-cc6a-4e87-8734-7351d04a9e47) \n", + "\n", + "Supported values for Theme are:\n", + "* `SUMMIT`\n", + "* `OBSIDIAN`\n", + "* `RIDGELINE`\n", + "* `MESA`\n", + "* `TIDAL`\n", + "* `SLATE`\n", + "\n", + "You can fetch and update the theme of your Collection as shown below. " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "0944bffb-0214-43aa-baca-5e4df77726ba", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'summit'" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.get_theme()" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "efd83de3-c9ed-4b9c-bc93-01f4ab6e6ea8", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.theme(Themes.TIDAL)" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "f72b14e2-5967-4c02-8851-e6c4ebd70671", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "
\n", + " \n", + " \n", + " \n", + "
\n", + "\n", + "
\n", + " Nature Collection\n", + " \n", + "

StoryMap by MMajumdar_geosaurus\n", + "
Last Modified: February 06, 2026\n", + "
0 comments, 2 views\n", + "
\n", + "
\n", + " " + ], + "text/plain": [ + "" + ] + }, + "execution_count": 28, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "my_collection.save()" + ] + }, + { + "cell_type": "markdown", + "id": "7e7b70d7-9881-47c4-98cf-8daceffc60c7", + "metadata": {}, + "source": [ + "The theme of the Collection has been successfully updated.\n", + "\n", + "![theme_change](https://github.com/user-attachments/assets/4039b10b-cd32-4071-ad31-b2bfdc8479ba)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.12.11" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}