ArcGIS Arcade
One language, to bind them, one language to rule them all
I attended Esri’s Dev Summit 2022, and I have been impressed by several things: the new visualization tools in ArcGIS API for JavaScript 4, integration with big data tools in the cloud, and more. But what really caught my attention is how prominent is Arcade everywhere in the ArcGIS platform now.
If you are a GIS analyst, you might not be able to escape it. It is used everywhere. You need to configure popups, labeling, map symbols, clustering, dashboard, or the more complex attribute rules. In short, it impacts all the tools you need to perform your job.
Because of its ubiquity, it might just be your perfect introduction to programming. And if you are a programmer, you will most likely be forced to use it with your favorite API. So let’s dive in.
What is ArcGIS Arcade?
In the terms of the official documentation, “Arcade is a portable, lightweight, and secure expression language used to create custom content in ArcGIS applications.” Portability is key there. You can create labels using an Arcade expression ArcGIS Pro, use the same Arcade Expression in your Web Map, or in your mobile application powered by any ArcGIS Runtime.
ArcGIS Arcade is lightweight because it is tailored to specific use cases. Some examples are:
- Creating label expressions in a map or a Web Map
- Configuring Popups in an ArcGIS Web Map.
- Creating attribute rules in ArcGIS Pro.
- Calculating attribute values in ArcGIS Pro
- Configuring dashboards widgets.
ArcGIS Arcade is not designed to create applications. It is designed to execute within the ArcGIS platform to perform those specific tasks.
Finally, ArcGIS Arcade is not JavaScript. It may look a bit like it, but it is not. Do not look for arrow functions. Arcade has its own rules.
Watch your profile
Because Arcade is meant to be simple, and specific, it introduces the concept of profiles. A profile is a task-based context that gives you access to just the information you need to do your job. Some profiles can be used in several parts of the ArcGIS platform such as Labelling, Popups, and visualization. Others only exist to do one task, such as the dashboard profile. It is best demonstrated with an example.
Let’s take a look at the Labelling profile in a Web Map. Using the new map viewer, I can create labels using Arcade by using a custom labeling expression.
When I click on the custom expression, our Arcade Editor opens. In the labeling profile, I have access to a single global variable named $feature. This variable represents each feature for which the Arcade expression will be run. I can read any attribute from it, and I can access its geometry. The editor provides access to a Test button that lets us run your expression against one of the features in our layer.
Now let’s compare that with the Popup profile on the same Web Map. I have configured a popup that uses the same text as for our label.
You can see the popup displays additional information: the average production. That means that in order to configure popups, Arcade gives me access to more information. When opening the editor, you can see that I have access to more than the current feature. I can access the entire layer as a Feature Set or other layers in the same layer collection. I can access that using the global variables $layer and $datastore. I can also access any layer in the map using $map.
This becomes very handy, especially if you know bits of HTML. You can use Arcade to generate different styles based on conditions. For example, what if we wanted to have different text colors if the production is above, or below the average production? With Arcade and HTML, we can do that.
What’s next?
By now, if you are a GIS Analyst, you should be learning Arcade. It is easy to learn even if you are just a dabbler with programming. It will let you configure your applications to meet needs you would never have met without a hard-core programmer before. And you will be using it in off-the-shelf solutions.
If you are a hard code developer, you can leverage those expressions in any language, API, and framework. You can use those in ArcGIS Pro, Runtime, and JavaScript API for ArcGIS 4. The same expression will work anywhere, and the language is easy to use. You can also now learn to delegate those fancy expression to your GIS analyst, who always love to be in control of their map.
Arcade opens the door for new levels of customization in our out-of-the-box apps and new opportunities for collaboration between GIS Analysts and Developers. And that, fellow GIS lovers, is what gets me excited.
References
- Getting started with Arcade: https://developers.arcgis.com/arcade/
- Getting started with Arcade in Dashboards: https://www.esri.com/arcgis-blog/products/ops-dashboard/real-time/getting-started-with-arcade-in-arcgis-dashboards/
- ArcGIS Arcade version matrix: https://developers.arcgis.com/arcade/guide/version-matrix/
The following resources are fantastic, but they do require access to Esri training.