Arcade’s Fire: Infinite Content
A roundup of resources to power you through your Arcade journey.
On February 11, Mark Ho and I delivered the “Arcade’s Fire: Inside Esri’s Scripting Language” webinar to introduce the lightweight and portable expression language being used across ArcGIS systems. Thanks again for attending and if you missed it, you can view the recording and download the slides on demand. We covered a lot of concepts during the hour, and we hope you left feeling confident enough to write your first few lines of code.
Since our time together was brief, Mark and I have curated additional resources and examples of Arcade scripts used across a variety of profiles. Before we dive in too deep, here is a recap of how, when, where and why Arcade is an important part of the ArcGIS system.
What is Arcade?
Arcade is a simple and lightweight scripting language intended for evaluating the values of attribute fields and geometries within the context of ArcGIS Pro, ArcGIS Runtime, ArcGIS Online, and the ArcGIS API for JavaScript. It was designed specifically for creating custom visualizations and more detailed labelling but is now implemented in a growing number of environments. It can be used in endless ways, including performing mathematical calculations, manipulating text, and evaluating logical statements.
Now that we know what Arcade is, it’s important to note that Arcade is not a full programming language. This means it is not designed for writing standalone apps nor is it a replacement for geoprocessing or automation. These tasks will continue to be done using Python and JavaScript.
Why Arcade?
Esri made the decision to develop its own scripting language that is geospatial first, secure, lightweight, and portable. But what does that mean? Let’s break it down.
Arcade was conceptualized and built upon four pillars – lightweight, portable, secure, and geospatial.
- Geospatial first – Arcade makes geospatial function and capabilities first-class citizens. This means the expressions you build are treated like any other attribute so they can be used to symbolize features in a map or dynamically display information in your popups. Something else that makes Arcade geospatial is its inclusion of feature and geometry data types, making it simple to call this kind of information in your scripts.
- Secure – Since Arcade is executed in a secure container and cannot be executed outside the ArcGIS system it doesn’t have the security vulnerabilities that open the door to malicious scripts.
- Lightweight & Simple – The Arcade syntax is very forgiving and can support even the most novice coder with its library of ready-to-use functions.
- Portable – The scripts you author in one environment can be understood by another without having to make syntax changes. For example, labels and popups that have been formatted using Arcade in ArcGIS Online will render the same way in ArcGIS Pro, the ArcGIS API for JavaScript and any ArcGIS Runtime APIs.
When to Arcade?
Arcade is great for simple tasks like:
- Combining fields together or calculating new fields on the fly
- Formatting existing values in a field by performing math or manipulating text
- Alter symbology (like transparency and rotation)
- Formatting labels and popup content to look cleaner
Arcade is useful for fancier tasks like:
- Evaluating logical statements
- Querying and manipulating geometries
- Establishing rules for attributes during the editing process
- Accessing related data
How to Arcade?
Simplicity was one of the main pillars driving the development of Esri’s own scripting language. As a result, its syntax is easy to learn and very forgiving. For example, its case insensitive, supports both implicit and explicit returns and simplifies complex calculations with its growing library of functions.
Check out the documentation for additional information about the Arcade syntax, structure and logic.
Where to Arcade?
Arcade is intended for use solely within the ArcGIS system and is executed within the context of a designated profile. Each profile has expected inputs that are available to the script as global variables and expected output types.
Mark and I have done a deep dive on a few profiles. Tutorials, example maps and resources are provided for the popup, visualization, labeling, and dashboard profiles.
Popup Profile
Arcade is used in the popup profile to return information that can be displayed in the view’s popups. The scripts should return either text, number or date types that can then be used to populate your popup.
The tutorial by Mark provides a detailed, step-by-step look at how Arcade is used to create detailed popup information. You can access his Popup Profile map to follow along with the tutorial.
In this tutorial you will discover how to:
- Build increasingly complex Arcade scripts by chaining functions
- Use geometry functions like Intersects to display information about intersecting point and polygon features
- Access related information within your map using FeatureSets function
- Embed Arcade expressions within the popups HTML code
Visualization Profile
Arcade is used in the visualization profile to drive the visualization of point, line, and polygon features. An expression’s output could be used to display symbol size, a number could be used to display class breaks or text could be used to display unique values.
These maps leveraged Arcade in some way to customize the symbology. See how in the StoryMap.
Find out how these maps were created using Arcade in this StoryMap! Here I provide a detailed, step-by-step look at how Arcade is used to create a variety of informative visualizations. You can access the Visualization Profile maps discussed in the StoryMap and test the code out yourself.
In this tutorial you will discover how to:
- Symbolize features based on percentages or rates that are calculated on the fly
- Visualize change over time by comparing variables within your layer
- Use Date functions to visualize time information in your data
- Control the size of point and line features at specific scales
Labeling Profile
In the labeling profile, the text output returned by the Arcade expression is used as the label that shows up on the map.
The following tutorial by Mark provides a detailed, step-by-step look at how Arcade is used to create clean and detailed labels. You can access the Labelling Profile map to follow along with the tutorial.
In this tutorial you will discover how to:
- Perform mathematical calculations on the fly
- Create and format multi-line labels
- Use logic to remove Null or unwanted text
Dashboard Profile
The Dashboard profile is used for the list and indicator elements in the ArcGIS Dashboards. An expression can be written to customize the way elements render data points. It is expected that the script returns a dictionary of name-value pairs specific for the element.
In the upcoming webinar about ArcGIS Dashboards, Mark will show you how to customize functionality and displays using Arcade. If you’d like to get ahead and start using Arcade in your dashboards right away, check out these blog posts:
- Getting started with Arcade in the ArcGIS Dashboards Beta
- Conditional formatting in dashboard indicators with Arcade
Register for the webinar now to meet the new ArcGIS Dashboards in town.
Don’t forget, we created an ArcGIS Online group that compliments the webinar. You can access the group at: bit.ly/arcadesfirewebinar (all lower case).
Our ArcGIS Online group includes supplemental resources from this Arcade webinar.
Loads of questions came streaming in throughout the presentation so we took the time to go through and answer them as best we can.
In Part 1, I have replied to your general Arcade questions and cleared up some remaining questions regarding the Visualization and Attribute Rules profiles. In Part 2, Mark covers in great details your questions about the Labelling and Popup profiles, in great detail.
Thank you again for your interest in Arcade. Most of all, thank you to Mark for his endless supply of Arcade Fire puns and throwback to classic video games.
Happy coding! We are cheering you on!
This post was translated to French and can be viewed here.