Using ArcGIS Arcade to your story's advantage

832
5
09-27-2023 12:09 PM
AbbyE_Esri
Esri Contributor
5 5 832

One of the many reasons people love ArcGIS StoryMaps is its simplicity- but what are your options when you want to add more complexity to your story than what seems possible in the app?

That’s when you may want to consider using ArcGIS Arcade to provide enhanced customization to your story’s mapping components, such a map pop-ups.

 

What is ArcGIS Arcade?

If you’ve never heard of ArcGIS Arcade, it’s an expression language that can customize content coming from ArcGIS apps. For example, it can perform calculations on data from feature layers, which can then be used as your text for pop-ups, or even to stylize text. It is also a desirable customization tool due to its ability to utilize geometry data (think points, lines, and polygons) in its calculations and results, like applying a 10 meter buffer around existing data points.

One advantage to using ArcGIS Arcade is its dynamic nature: you can apply a calculation to all data within your story, and if that data changes frequently, so will your expression results (as noted in Your Arcade Questions Answered). To learn more about the basics of ArcGIS Arcade, take a look at the links at the bottom of the story.

 

Arcade expressions

When building an expression in Arcade, you can use a combination of profile variables and functions. These items are organized in the tabs of the Arcade expression editor.

Tabs:

  • Profile variables: Within this tab, you can select inputs for your expression based on the data within your map. For example, the $feature profile variable will hold a selection of the feature layers within your web map that you can select to add to your Arcade expression. You can also build these expressions based off of views you’ve created with the $view variable.

  • Functions: Here you’ll find all the functions you can apply to your data, from reformatting dates, to applying a buffer. Check out this page for a glossary of the available functions.

  • Suggestions

    • Templates!

      • If you are trying to build an expression and don’t know where to start, try out one of the suggested templates. This will give you an expression with generic variables that you can manually alter to utilize your own variables. There are even templates for creating charts:

         

Screenshot 2023-08-30 at 9.04.38 AM.png

A word on arcade functions

It’s up to you to decide how you want to use the functions in the expression editor, whether it be to alter the visual style of your layer, or to customize the information in your pop-up.

  • Some of the main tools you can use in the expression editor include:

    • Date functions

      • Perform actions like calculating a week ahead from the original date (‎DateAdd(dateValue, addValue, units?)), or converting a date/time to the time zone of the reader (‎ToLocal(inputDate)).

    • Math functions

      • Any calculation you can imagine, you can probably accomplish with Arcade. Think getting the mean of numbers (‎Average(numbers)), the sum (‎Sum(numbers)), or even generating a random number each time the arcade function is called (Random()).

    • Text functions

      • Here you can apply any format to the data (‎Text(value, format?)), remove undesirable spacing from text coming from your data (‎Trim(inputText)), or even call the specified number of characters from the beginning of a text value (‎Left(value, charCount)).

 

Arcade and pop-ups

You can use Arcade to format your pop-ups by calculating statistics from your layer, without having to make entirely new fields that are precisely formatted with this pre-calculated data.

 

Arcade and layer styles

Using ArcGIS Arcade on your layer can help transform the visualization of your data. Let’s say you want to apply a buffer to your Fault line data to inform your reader of when they may be buying a home near an earthquake prone area. You can apply that buffer with Arcade!

 

Calculating fields for map tours

Another place to utilize ArcGIS Arcade is within the fields of a feature layer that you’re planning to use for a data-driven map tour. You can calculate values of a new feature layer field based on data within the existing fields. This results in highly customizable data-driven map tours.

  • To calculate one of your feature layer fields, go to the item details page of your feature layer. Click the Data tab, then the Options bar on the table to click Add Field. Lastly, click on the new field title and click Calculate.

Use your customized field as your descriptions for your map tour points. If you’re working with a lot of data, this can save significant time by concatenating the important details of your fields. It can also be helpful for performing data analysis on your fields, in bulk, like calculating an average distance from a point, reformatting a date, or returning a certain field over another depending on the logic supplied!

Here’s a simple example of concatenation performed on a feature layer of Los Angeles Historical Sites. Let’s say you wanted to combine the information like hours of operation, and what number to call for additional information. The result was the calculated Map Tour Descriptions field:

Screenshot 2023-08-29 at 2.24.27 PM.png

A note here that when calculating a field from the Data tab, this calculation will be run in bulk for all features. It will NOT update when changing data from referenced fields, and it will not save the previously utilized calculation. This makes it a great tool for information that isn’t likely to change over time, like distances between fixed points.

You can also go in after running the calculation and manually alter individual results to your liking.

Now, I’ve created a map tour from the feature service, and designated the Map Tour Descriptions field as the Place description:

image-20230829-184308.png

 

How can you use ArcGIS Arcade in your story?

Sometimes, you want to add some more depth to your map’s pop-ups and visualization. While you can’t perform this operation right from the ArcGIS StoryMaps builder, you can complete this through formatting your pop-ups in the Map viewer with Arcade.

Let’s take a look at the Arcade expression editor together:

 

Screen Recording 2023-07-03 at 3.07.40 PM.gif

There are three main places to use Arcade within your web map: Your pop-ups and your layer style.

  • To get to the Arcade expression editor for your pop-up, click Pop-ups on the Settings toolbar, and the Add content button to find Arcade.

  • To open the Arcade expression editor for your layer styles, click Layers on the Contents toolbar. In the Layers pane select your desired layer, then click Styles on the Settings toolbar. Click Expression on the Styles pane.

 

Where should you start?

Take a look at your story and decide what it might benefit from; Does your story need richer pop-ups, or more relevant map visualization for the story’s focus? Maybe you’d like to provide highly customized descriptions in your map tour. All of these items can be added with a little help from ArcGIS Arcade.

 

Let's Learn

There are countless resources to help familiarize yourself with ArcGIS Arcade. Here are just a few tutorials and reference documents to get you started:

 

Resources:

Get started with ArcGIS Arcade

Arcade | Documentation | ArcGIS Developers

Access attributes from another layer with ArcGIS Arcade

GitHub - Esri/arcade-expressions: ArcGIS Arcade expression templates for all supported profiles in t...

 
5 Comments