Arcade Expression Language – You will want this!

What is this thing called Arcade, and when would I use it? That’s a great question. First I’ll make a bold statement, then give some examples.

Any time you need to have that ONE VALUE that can be used to label, identify, or symbolize a feature then you can probably make that value with an Arcade expression.

So as you may guess, an Arcade expression will return a single value. You can display that value in a pop-up, use it as the label on a feature, or feed it into the symbology engine and symbolize the feature.

Gosh that sounds good, but why is it different that what I can already do? The difference is that you can use fields and an Arcade expression to calculate the value on-the-fly each time the map is drawn. In the old-timey method you would create a new field and calculate a value into that field. Then you would use that field for your label or symbology. However with arcade you don’t need to make that field – just calculate it as you go.

What DOESN’T it do? Well it’s not a stand along scripting language. You won’t have a file in a folder that you ‘run’ and get results or manipulate files. It doesn’t replace Python (or even ModelBuilder) because it’s not intended to do any sort of process automation. You write Arcade INSIDE the dialog boxes for label expressions, pop-up displays, symbology controls, and other areas – both for ArcGIS Pro AND for ArcGIS Online.

Here’s an example. You know that your datasets contain fields that ArcGIS automatically manages. These include the length of lines and the area of polygons – and for argument’s sake let’s say your map units are meters for length and square meters for area. But sometimes you want to display a value in a chart that is acres instead square meters. If you make a field for this, then each time you edit you’d better be sure to recalculate the field before using that data – in a chart, analysis, or symbology. Your solution now is to write an Arcade express that will calculate acreage on the fly. When the chart is displayed or the symbology refreshed the Arcade expression will automatically show the correct values. You will NEVER have to worry about your calculated field values being out of date.

But wait – there’s more, as Ron Popeil would say! Arcade also includes the ability to do cross layer calculations. That means if you have a layer that shows county boundaries and a second layer that shows water well locations, you can do a cross layer calculation in the county layer to show the total number of wells in each county. No new layers are created – no new fields are created – but the value you want is calculated and used on the fly.

When would you use that? Well what if the data you are working with isn’t yours – it’s coming off an Internet map service and is read-only. The option to add a new specialty field is off the table – can’t be done. Plus if the data is ever updated or edited by the owner, the Arcade expression will update your results automatically. Just set it and forget it. That’s pretty nice!

How hard are these things to write? Well if you aren’t real keen on being a programmer then you might have some trouble here. There are a lot of customization features in ArcGIS that don’t require you to write code, but this ain’t one of them. You will need to understand text formatting, use of variables, date manipulation, logic statements, and more. While this isn’t a stand-alone scripting language, it relies on a lot of the same programming knowledge. If you already program in other languages you’ll see a lot of familiar things. If you only do some casual programming then you will probably do fine and will learn some new techniques. And if you aren’t a programmer, there are still some uses for you but I’m afraid you will have to up your game a bit to get full usage out of Arcade.

Now the best part. Arcade works in ArcGIS Pro for your desktop applications AND in ArcGIS Online for ALL of your web applications. And it uses the exact same code. If you write an Arcade expression in ArcGIS Pro desktop then serve it as a web service, the Arcade expression goes with it and runs without modification. It’s truly cross-platform. And that makes sense because it’s designed that way.

When you move your maps and analysis to ArcGIS Pro you will MOST DEFINITELY want to learn to use Arcade.