Introduction to Briefings (ArcGIS StoryMaps)
Using the ArcGIS API for Python you can build Briefings in ArcGIS StoryMaps. Briefings offer a slide-based output ideal for delivering presentations that integrate maps and data from your organization. You can now create elegant and interactive slide-based presentations called briefings for succinct storytelling and offline sharing with ArcGIS StoryMaps.
from arcgis.gis import GIS
from arcgis.apps import storymap
from arcgis.apps.storymap import Briefing, Themes, Text, TextStyles, Image, BriefingSlide, SlideLayout, Mapgis = GIS(profile='your_online_profile')ArcGIS StoryMaps enable users to add content through various content type elements. The following content element types are supported within the ArcGIS API for Python.
- Image
- Image360
- Video
- Audio
- Embed
- App
- Map
- Text
- Button
- Gallery
- Swipe
- Sidecar
- Timeline
- MapTour
- Places
- Code
- Table
- ExpressMap
- Infographic
- Navigation
- Cover
- Separator
Specific to Briefings, the following content elements are additionally supported:
We will start by creating a Briefing and then updating the Cover and Theme for this Briefing.
my_briefing = Briefing()The Cover is the first slide in the briefing. We will update necessary properties such as a title, summary etc. of the cover slide and we define the Image below that we would like to include on the cover slide.
img = Image("https://www.nps.gov/npgallery/GetAsset/69680c29-caa3-42da-93d9-32925e9ed409/proxy/hires")A key thing to note in the cell below is that each slide of the Briefing can be accessed via the slides property of the Briefing using the index of the slide. The first slide (index = 0) will always be the cover slide, and we access it as follows:
cover = my_briefing.slides[0].covercover.title = "Nature Presentation"
cover.summary = "Briefing about nature created programmatically"
cover.by_line = "Nature Briefing"
cover.media = imgThemes
Theme sets the visual style and appearance of the briefing. ArcGIS StoryMaps supports the following themes:
The ArcGIS API for Python supports these themes through type enumerations which include:
SUMMIT= "summit"OBSIDIAN= "obsidian"RIDGELINE= "ridgeline"MESA= "mesa"TIDAL= "tidal"SLATE= "slate"
You can fetch and update the theme of your briefing as shown below.
my_briefing.theme(Themes.SLATE)True
my_briefing.set_logo('D:/Github Projects/geosaurus/tests/resources/storymap/storymap_image_river.jpg')True
We will now save this Briefing and verify these updates. Since we are saving this for the first time, we provide a suitable title in the save() method.
It is important to save() the Briefing (without title parameter) everytime you make changes or add new slides. This method helps update the item with your desired changes.
my_briefing.save(title = "Nature themed Briefing slides")We have successfully updated the Cover or opening slide of the Briefing.
Concept of slides and blocks
Similar to traditional presentations with slides, Briefings come with BriefingSlides to add structured content to your Briefing.
Each slide within has one or more blocks, and the number of blocks need to be specified during slide creation using the num_blocks parameter. A block represents a section that holds individual content elements.
We start by creating three slides below.
new_slide = BriefingSlide(layout=SlideLayout.FLEXIBLE, num_blocks=1)
slide1 = my_briefing.add(slide=new_slide)new_slide = BriefingSlide(layout=SlideLayout.FLEXIBLE, num_blocks=2)
slide2 = my_briefing.add(slide=new_slide)new_slide = BriefingSlide(layout=SlideLayout.SINGLE)
slide3 = my_briefing.add(slide=new_slide)Adding text to a block in a slide
You can add Text to your Briefing by providing the text string of choice to thetext parameter of this Text class.
You can also specify the style you would like to render your text in, using the following TextStyles enumeration values supported in the ArcGIS API for Python.
- BULLETLIST = 'bullet-list'
- NUMBERLIST = 'numbered-list'
- HEADING = 'h2'
- SUBHEADING = 'h3'
- HEADING1 = 'h2'
- HEADING2 = 'h3'
- HEADING3 = 'h4'
- PARAGRAPH = 'paragraph'
- QUOTE = 'quote'
Our first slide has one block. We will update it with a heading and a text summary of the contents of this Briefing.
block_1 = slide1.blocks[0]heading = Text(
text="Contents",
style=TextStyles.HEADING,
)block_1.add_content(heading)Text(text=Contents)
quote = Text(
text="This Briefing will have images related to nature, and a map about the coverage of Forests in the US.",
style=TextStyles.QUOTE,
)block_1.add_content(quote)Text(text=This Briefing will have images related to nature, and a map about the coverage of Forests in the US.)
my_briefing.save()The first slide is successfully updated with text.
Add images to blocks in a slide
Our second slide has two blocks. Let's add images to each of those blocks.
block1 = slide2.blocks[0]
block2 = slide2.blocks[1]image1 = Image(
"https://www.nps.gov/npgallery/GetAsset/36106ED0-1DD8-B71C-07ED73544EA246C7/proxy/hires"
)
image2 = Image(
"https://www.nps.gov/npgallery/GetAsset/0022D3FF-1DD8-B71B-0BE3AD4C48F96FF9/proxy/hires"
)block1.add_content(image1)
block2.add_content(image2)Image(image='https://www.nps.gov/npgallery/GetAsset/0022D3FF-1DD8-B71B-0BE3AD4C48F96FF9/proxy/hires')
We can also set a title to the slide using the property.
slide2.title = "Visual Glimpses"my_briefing.save()Our briefing has now updated the two blocks with images.
Adding a Map to a block in a slide
We will now fetch a map item and add it to the third slide.
Note: We are fetching an item of type
Web Map, and then invoking the StorymapMapcontent class to add the item as aMapto our briefing.
map1 = gis.content.get('dd3e4259b7434f1ebd488c09a8611ddf')
map1_for_storymap = storymap.Map(map1)We will add the map to a block in the third slide. Following that we will se another pattern for setting the title of this slide.
block_3 = slide3.blocks[0]block_3.add_content(map1_for_storymap)Map(item='dd3e4259b7434f1ebd488c09a8611ddf', type='Web Map')
slide3.title = Text(
text="Forest Service USA",
style=TextStyles.HEADING,
)my_briefing.save()The slide now displays this map.
Duplicate this briefing
Similar to a StoryMap, you can also duplicate() a Briefing.
Note: The duplicate() function will create a copy of the Briefing item alone. To copy the deep dependencies of the Briefing (e.g., maps, scenes, layer, tables), you will need to use the clone_items() function. Please refer to the Cloning and Editing of StoryMaps guide to learn more about these differences.
duplicate = my_briefing.duplicate("Copy of my Nature themed Briefing")
duplicateMove a slide to the end
You can also move() or re-position slides in a Briefing. Let's see a few examples below.
If no value is provided for the position parameter, it moves the slide to the end.
Note: Cover slide (index 0) cannot be moved.
my_briefing.move(slide=2)True
Move a slide to the top
my_briefing.move(slide=2, position=1)True
my_briefing.save()Copy updated content over to the duplicated Briefing
The ArcGIS API for Python also allows for copying selective sections of a Briefing over to another using the copy_content() method. Use this method if you do not wish to clone all the content of a Briefing.
This capability can be beneficial in a few cases.
- You may already have another Briefing item in your organization with relevant slides and information that you need to add to your current Briefing, without cloning the entire Briefing.
- You may have cloned an existing Briefing, updated it with a few more slides and would like to copy those over back to the original Briefing.
We will explore the first use-case through an example below.
Note: If you wish to copy all the slides of a Briefing, you need to ensure that you are not copying the Cover slide of one Briefing over to another. We can remove that slide by excluding its index, as shown below.
source_briefing_item = gis.content.get('203ca5e1ffc141528cbdf7bced801274')
source_briefing = Briefing(source_briefing_item)
source_briefingcontent = source_briefing.slides[1:]source_briefing.copy_content(target_briefing = my_briefing, content = content)True
Publish the Briefing
We will now publish this Briefing by setting publish=True in the save() function.
Note: While we have demonstrated the process to programmatically
save()the Briefing throughout this guide, it is strongly encouraged to view and verify the Briefing in the UI and publish it there, especially for the first time you publish a Briefing.
my_briefing.save(publish=True)