Skip to main content

ArcGIS Arcade: Are you ready to play?

Are you ready, Player 1, to rack up high scores? Get ready to enter your initials when you get the #1 spot with your Arcade mastery.

ArcGIS Arcade: A new game

ArcGIS Arcade is more than flashing lights, beeps and buzzers. It’s a helpful tool for making your maps and map information more presentable and dynamic.

Arcade was developed by Esri to be used across the ArcGIS system. It enables individuals to control and manipulate data and aspects of presenting data and information in many ways. Think of it like the codes used to solve riddles in old-school video games. If you’re an experienced coder, it’s similar to JavaScript and is lightweight and easy to work with. If you’re a newbie to this coding stuff, it’s one of the easier languages to learn. Knowing the fundamentals will go a long way to get you into the game and advance your usage of it.

Arcade is an expression language, meaning it is not used to write code for applications but is instead intended for things like calculations, altering visual variable properties and making on-the-fly decisions about how you want your data presented.

Like DOS did for PCs back in the day (MS-DOS 4 just went open source, incidentally), Arcade can be used across the ArcGIS system to replicate behaviours, actions and appearances in different maps or do very specific things depending on the context in which it is being applied.

A hierarchy diagram with the ArcGIS Arcade logo at the top, with several items stemming down from it. The first item is the ArcGIS Arcade playground, represented as a window with two Arcade expressions already typed in. The second is ArcGIS Pro, represented as a window with a map on it, plus those two Arcade expressions overlaid on top. Finally, the third item is ArcGIS Online, represented as the same map as in Pro but with different symbology. This also has the two Arcade expressions overlaid on top.

Context is critical when it comes to Arcade. What I mean by context is where you’re using the Arcade expression. Many of these possible contexts will be outlined below. The important thing to remember is that the language stays the same, but what you can do with it will change based on where you are using the code. In Arcade-speak, we call the usage context a profile.

A hierarchy diagram with the words “Arcade profile” at the top. Four items flow from the top level of hierarchy. The first is labelled “Execution context” and is represented by an application window and a mobile device on a green backdrop. The second is labelled “Profile variables” and is represented by a variable x in brackets on a blue backdrop. The third is labelled “Function bundles” and is represented as four cogs tiled together on an orange backdrop. The final item is labelled “Data types” and is represented as the letters T, N, D and FS tiled together on a violet backdrop.

First life: Starting off

The most fundamental place to use an Arcade expression is when calculating field values in bulk. You can almost think of this as entering formulae in a certain unnamed spreadsheet program.

A process flow diagram with three stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by a spreadsheet or table with three columns, titled “Units”, “Area” and “Capacity”, and four rows, each of which contain some example data. The “Capacity” column is highlighted. The second stage in the process is called “Field calculation”; the user has inputted an Arcade expression (in this case, “$feature.Area / $feature.Units”) into a field. The third and final stage in the process shows the output of the Arcade expression in the “Capacity” column of the first spreadsheet, this time highlighted in green.

However, Arcade can be much more than just a formula. We can allow each expression to make decisions about specific attribute values, if desired. And this is where its real power lies.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Numbers” on a green backdrop. The third stage is represented by the words “Field calculation” on a blue backdrop, overlaid with a gray cog in the lower right-hand corner. The fourth and final stage in the process is a three-column, four-row table with columns labelled “Name”, “Open” and “Years” with the “Years” column highlighted in green. Underlying the entire diagram is a snippet of Arcade code that reads as follows: “Author expression < if ($feature.Open != NULL) { DateDiff(Now(), $feature.Open,’years’); }”.

We can also use Arcade to change the visual properties of features in a map, such as transparency, rotation, colour and size, similar to what we would do using attribute-driven symbology, but with more flexibility and the added power of decision making.

A map of Indonesia, Timor-Leste and Singapore as well as sections of Malaysia, southern Brunei and western Papua New Guinea. A number of black, triangular symbols point to various locations in Indonesia.

Second life: the boss

Arcade can be used to present label information, perform on-the-fly calculations, make decisions based on attributes, combine multiple attributes, stack text and more.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the words “Open Space, 23.12 acres” on a green backdrop. The third stage is represented by the words “Labelling options” on a blue backdrop, overlaid with a gray cog in the lower right-hand corner. The fourth stage, which represents the output of the expression, is a map with Open Space labelled as being 23.12 acres, Water labelled as being 6.47 acres and Residential labelled as being 12.78 acres. An accompanying Arcade expression reads: “Concatenate fields < “<BOL>”+Proper($feature.LANDUSE)+”</BOL>”+TextFormatting.NewLine+round($feature.ACRE,2)+” acres””.

Arcade can make decisions on the fly and apply changes to labels.

An image in two halves. The left-hand side of the image is an Arcade expression that calls up the area of each polygon on a map, labels those polygons with that area number and applies the label “ km2” (kilometres squared) to each of those labels. The right-hand side shows the output: a map of an unidentified land mass surrounded by water, with various parts of the land mass represented in gray, red, blue and green with labels like “227 km^2” and “1559 km^2”.

We can affect the symbology of features and the entries displayed in the Catalogue pane/legend, as in the following example, where classification labels are applied to the legend and symbology by the expression.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Text” on a green backdrop. The third stage is a three-item-tall stack of rectangles, each representing a colour and a value: “Low” is represented by light green, “Medium” by emerald green and “High” by orange. The fourth and final stage is the output of the process, which is a map labelled using the three colours symbolized in the third stage. The image is accompanied by two Arcade expressions: the first, “Calculate density”, reads “var density = $feature.BUILDINGS/$feature.ACRE”. The second, “Assign categories”, reads “When(density < 1, “Low”, density >= 1 && density <10, “Medium”, density >=10, “High”, “Other”)”.

Arcade can also be used to alter how information is presented in a pop-up by performing calculations dynamically, altering the colour of text-based attribute properties and more. The following example shows how Arcade can be used to apply conditional formatting within a pop-up based on an attribute value.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Text” on a green backdrop. The third stage is a blue rectangle containing the text “Pop-up text template” and overlaid with a small gray cog. The fourth and final stage is a gray map overlaid with the text “This land use area is residential”, where the word “residential” is coloured bright blue. The image is accompanied by two Arcade expressions: the first, “Author expression”, reads “if($feature.LANDUSE == “residential”){ return “0000FF”} if ($feature.LANDUSE == “open space”){ return “00FF00”}”. The second, “Configure pop-up text template”, reads “This land use area is <span style=”color:#{expression/expr0};”>{LANDUSE}</span>.”

Third life: the big bad evil guy

With Arcade, you can go outside of the ArcGIS Pro or Online environments and begin working with form configuration for mobile apps such as ArcGIS Field Maps. These configuration options can be simplistic or more complex, embedding conditional behaviour in the form and making it responsive to user input.

Here we see an expression that dynamically populates a form field with the name of the user using the Field Maps application.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Text” on a green backdrop. The third stage is a blue rectangle containing the text “Form calculation” and overlaid with a small gray cog. The fourth and final stage is a representation of a fillable form within ArcGIS Field Maps called “Tree Inventory”, with fields called “Collection Date”, “Name”, “Tree Type”, “Diameter” and “Condition”, and with a button labelled “Create” at the bottom of the form. The image is accompanied by an Arcade expression labelled “Author expression”, where the expression itself reads “var userInfo = GetUser(portal(“https://www.arcgis.com”),””) return (userinfo[“fullName”])”.

We can get into some really advanced things using Arcade, too, such as working with attribute rules in a feature class’s table. Attribute rules allow us to dynamically perform calculations, apply editing constraints and perform data validation on the fly by applying embedded expressions. The huge advantage of this is that the expression essentially becomes a part of the dataset, and anyone using that data will also, automagically, be using the attribute rules, thus allowing you to apply potentially rigorous QA/QC in an unattended manner.

There are three types of attribute rules:

Calculation: The expression is executed and returns the next sequence value for the new sewer drain cover feature. 

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Number” on a green backdrop. The third stage is a blue rectangle containing the text “Insert edit operation” and overlaid with a small gray cog. The fourth and final stage is a table with three columns labeled “ID”, “Type” and “Material” and three rows. The last cell in the “ID” column is highlighted in green.

Constraint: This expression is executed and returns a Boolean value to the Insert edit operation if the Type field is not completed, which causes the edit to fail.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “False” on a green backdrop. The third stage is a blue rectangle containing the text “Insert edit operation” and overlaid with a small gray cog. The fourth and final stage is a table with three columns labeled “ID”, “Type” and “Material” and three rows. The last row of the table, which has a missing value in the “Type” column, has been struck out and highlighted in red.

Validation: This Arcade expression is used to set a validation rule for the Material field based on the Height field.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Boolean” on a green backdrop. The third stage is a blue rectangle containing the text “Error Inspector” and overlaid with a small gray cog. The fourth and final stage is a table with the header “Error inspector” and three columns labeled “Shape”, “Feature” and “Rule”. The first row of the table contains a shape icon in the “Shape” column, the words “Power Pole” in the “Feature” column and the word “Material” in the “Rule” column. The diagram is accompanied by an Arcade expression called “Author expression”, which reads as follows: “if ($feature.Height >= 65) { If (DomainName($feature, ‘Material’) == ‘Steel’) { return true; } else { return false; } } else { return true; }”.

Arcade is particularly handy in ArcGIS Dashboards. Many different elements can have embedded expressions that are applied dynamically, in real time, the results of which can affect the data and information presented in the element, or even the appearance of the element itself.

The data used in an element can already be referenced by existing elements in the dashboard or be referenced explicitly by the expression as seen in the example below:

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Dictionary” on a green backdrop. The third stage is a blue rectangle containing the text “Gauge element” and overlaid with a small gray cog. The fourth and final stage is a ring chart indicating 70%, with the title “Conversion Rate”. The diagram is accompanied by an Arcade expression called “Data expression”, which reads as follows: “var p = Portal(“https://www.arcgis.com/”); var rSales = FeatureSetByPortalItem(p, ‘f4758d402ac045e08321fc070039c7d4’) var convDict = { ‘fields’: [{‘name’:’cRate’, ‘type’:’esriFieldTypeDouble’}], ‘geometryType’: ‘’, ‘features’: [{‘attributes’: {‘cRate’: Round((SUM(rSales, ‘conversions’)/SUM(rSales, ‘visits’))) }}]}; return FeatureSet(convDict);”.

In this example, you see that certain entries in the list element are highlighted based on an attribute.

A process flow diagram with four stages. Gray arrows indicate the movement from one stage to the next. The first stage is represented by the ArcGIS Arcade logo overlaid with a symbol representing a document. The second stage, labelled “Return values”, is represented by the word “Dictionary” on a green backdrop. The third stage is a blue rectangle containing the text “Table element” and overlaid with a small gray cog. The fourth and final stage is three-row table titled “Comment” with cells containing “Road has pothole”, “Stop sign missing” and “Pothole in street”. The diagram is accompanied by an Arcade expression called “Advanced formatting”, which reads as follows: “var hasKeyword = Find(‘pothole’, Lower($datapoint[“Comment”])) >= 0; var color = IIF(hasKeyword, ‘red’, ‘’); return { Comment: { displayTest : $datapoint.Comment, textColor: color, }, }”.

1-Up

Now we’re getting into some really funky stuff! With recent changes to the Arcade framework, we can even begin using HTML injection with our Arcade expressions. This allows us to reference many expressions simultaneously, apply HTML behaviours and so on when presenting data and resources to our users, as seen below.

Even the Esri Community is getting in on the act. There are community samples shared that present expressions for specific use-cases. For example, in the Community, use the search term “Using Arcade to Calculate the Slope of a Line” (the keyword “Arcade” is important), which would take you to the following sample: Using Arcade to Calculate the Slope of a Line. There you will find an explanation and code that you can bring into your own projects.

A screenshot of the front page of the Esri Community, “A global community of Esri users where you can find solutions, share ideas and collaborate to solve problems with GIS”. A feed of the latest activity is shown, as well as a search bar and a menu for browsing communities.

Where to turn from here? or "up up down down left right left right"

Arcade has the potential to be the ultimate cheat code. You just need to learn how to write the code to do what you want to do—just like those game tutorials we like to skip, there is a lot of value there.

I urge you to check out our course offerings below:

  • ArcGIS Arcade: Join the Playground! To learn the fundamentals of Arcade syntax, this half-day course takes you right from dropping your quarter in the machine and teaches you how to write Arcade code from scratch.
  • Get Started with ArcGIS Arcade: For detailed training on the different applications of Arcade, as shown above, this new two-day course takes you all the way to gaining that 1-up and racking up points.

So don’t ragequit. There are plenty of resources available to help you get that high score. Now, armed with all of this information and knowledge, get the training you need, get in some practice and get ready to enter your initials when you set that high score.

Want to stay informed about all the latest training opportunities at Esri Canada? Visit Esri Canada’s Communication Preference Centre and select the “Training” checkbox to get a monthly roundup straight to your inbox.

About the Author

André Piasta is a Senior Instructor on the National Training Team at Esri Canada. He teaches the full range of courses that Esri Canada offers, focusing on ArcGIS Enterprise and ArcGIS Developers. His love of mapping, geography and computer programming began in childhood, and his primary goal is to pass on that love to anyone that takes a course. André refers to himself as an “accidental geographer”, having discovered the geospatial discipline while pursuing a degree in Computer Science at the University of Regina. Outside of work, André spends time working with a variety of cultural and volunteer organizations.

Profile Photo of André Piasta