Have you ever had multiple fields in your data that you wanted to display as one unified symbol in ArcGIS Online? Arcade makes it easy to take any fields in your dataset and combine them into one symbol on your map.
The steps are outlined below using Esri’s Live Feed earthquake data.
At the end follow the link to Earthquake Mapping Part II: The Cartography of Time, Magnitude, and Alert Levels which dives deeper into the cartographic riddle for displaying hundreds of earthquake symbols on a map.
Earthquake Data in the Living Atlas
The Living Atlas of the World hosts recent global earthquakes from the U.S. Geological Survey (USGS) and their Prompt Assessment of Global Earthquakes for Response (PAGER) program.
This Live Feed is updated every five minutes and has fields detailing individual earthquake information including an event’s ID, Hours Old, Magnitude, Location, and PAGER Alert Level.
Attributes and Fields
All hosted feature layers in ArcGIS Online contain an attribute table. Attribute tables have rows (features) and columns (fields) that store the data for that layer.
What’s Important for Mapping Earthquakes?
This map needs to show earthquakes of interest, but not get obscured by the hundreds of other points that are also part of the story. The map will need to logically show:
When was the earthquake?
How big was the earthquake?
What are the impacts on people and the environment?
This is a situation where the important information is contained in three fields of our data:
Let’s first take a look at how these fields look individually:
Classified by Hours Old
Classified by Magnitude
Classified by Alert Level
It’s hard to differentiate the earthquake’s time, size, and severity as you flip between the maps and yet we need to be able to see them all.
Interpretation is at the Heart of Our Work
Is a 6.5 magnitude earthquake important? It depends right?
When did it happen? Where? In the middle of nowhere? A populated area? Are roads and buildings damaged or are people hurt?
We want to display each of our three fields genuinely, but also honor and respect each attribute’s contribution towards understanding of the complete dataset.
Compelling map symbology requires knowing your data fields, evaluating each one’s importance, and being able to interpret them together in a way that will uniquely, and beautifully, tell their story.
In order to visualize the fields together on one map they need to become combinations of:
3 Time Periods – Past 24 hours, 1 week, and 3 months
4 Ranges of Magnitude- 4 to 4.9, 5 to 5.9, 6 to 6.9, and +7
5 Classes for Alert Level – None, Green, Yellow, Orange, and Red
Without any additional data processing we will use Arcade to join these fields together to form new sets of information for our map.
Before you Start
Esri’s Earthquake data is located here (copy the URL on the bottom right of the page). Add this as a Web Layer to your ArcGIS Online map.
Begin by filtering out all of the smaller earthquakes that are < 4 magnitude.
Since earthquakes that are within the range of 4-4.9 magnitude (See The Modified Mercalli Intensity Scale) are detectable by people outdoors and are strong enough to wake some people up at night, this is a good threshold for representation on the map. See this blog about applying filters.
Building the Expression
Click to “Change Style” of the layer.
Under “Choose an attribute to show” scroll to the bottom and select “New Expression”.
Paste in the following Arcade expression:
$feature.mag >= 4 && $feature.mag < 5, “Mag 4-4.9”,
$feature.mag >= 5 && $feature.mag < 6, “Mag 5-5.9”,
$feature.mag >= 6 && $feature.mag < 7, “Mag 6-6.9”,
“Mag >= 7”)
$feature.hoursOld < 25, “Past 24 Hr”,
$feature.hoursOld > 24 && $feature.hoursOld < 145, “Past Week”,
“Past 3 Months”)
var PAGER =When(
$feature.alert == ‘GREEN’, “PAGER GREEN”,
$feature.alert == ‘YELLOW’, “PAGER YELLOW”,
$feature.alert == ‘ORANGE’, “PAGER ORANGE”,
$feature.alert == ‘RED’, “PAGER RED”,
TIME + ” ” + MAG + ” – ” + PAGER
Please Note: When you copy the above text and paste it into Arcade you will have to modify the ‘single’ and “double” quotes. They will come in formatted curly and you need to make them straight.
It will look like:
What this code is saying is:
When (the magnitude is greater than or equal to 4 and less than 5, give it the name “Mag 4-4.9”,
When the magnitude is greater than or equal to 5 and less than 6, give it the name “Mag 5-5.9”,
When the magnitude is greater than or equal to 6 and less than 7, give it the name “Mag 6-6.9”,
Anything else greater than or equal to 7, give it the name “Mag >=7”)
When (the hours old is less than 25, give it the name “Past 24 hr”,
When the hours old is greater than 25 but less than 145, give it the name “Past Week”,
Anything else give it the name “Past 3 Months)
When (the alert equals “GREEN”, give it the name “PAGER GREEN”,
When the alert equals “YELLOW”, give it the name “PAGER YELLOW”
When the alert equals “ORANGE”, give it the name “PAGER ORANGE”
When the alert equals “RED”, give it the name “PAGER RED”,
Anything else give it the name “NO PAGER”)
Put them all together and they are named: TIME + space in between words + MAG + space in between words + PAGER
Applying the Expression
We have our expression to classify the earthquakes by Time, Magnitude, and Alert Level. Watch the short video to see how to apply it and rearrange the new classifications.
Now That We Have What We Want
Since we have just combined three attributes together, and given what those are, you might be thinking that this is going to produce a lot of results. You are right! This will give us 60 possible combinations!
Without a doubt mapping earthquakes can get complicated quickly given the various Time, Magnitude, and Alert Level combinations!
Arcade Makes it Possible to Map 100’s of Earthquakes Dynamically
Combining fields in Arcade is a great way to visualize your map dynamically. This is handy when you have data that has hundreds of points and also has the potential for 60 symbols.
There are resources available for using Arcade in your ArcGIS Online maps. You can start by visiting the Arcade documentation page, Esri Technical Support, or check out this blog on Smart Mapping for other Arcade examples. There are also a few more linked blogs below.
Up Next…Earthquake Mapping Part II
Keeping the symbols simple and intuitive are important for this map. Follow this link to Earthquake Mapping Part II: The Cartography of Time, Magnitude, and Alert Levels to find out how this Arcade expression gets symbolized in this complex earthquake map!
The final map is here and the app is here. Here are a couple of sneak peeks below.
One Last Note…
I would like to thank Paul Dodd for his help with the Arcade expression. Paul’s knowledge of computers and Esri remind me of wizardry and I have tremendous gratitude for his time and thorough explanations.
By the way…I grew up in the San Francisco Bay Area in California and I experienced the devastating 1989 6.9 magnitude Loma Prieta earthquake. I brought that experience to this project and it was a frame of reference for me.
Commenting is not enabled for this article.