Use Arcade Expressions to Map Your Ideas

How do you make a web map if the layer you are using does not contain the exact attribute field that you need? With the December release of ArcGIS Online, you can now use Arcade expressions to get your basic mapping work done, as well as imagine powerful new map products, without having to edit the source data.

It used to be the case that when the map layer you’re working with does not contain the exact data you need, you were stuck. Until now, you would need to obtain the source data, add a field to it, and calculate the exact thing you need. Or, you would have an app developer write custom code to calculate exactly what you need.

For decades, the process for making a map included two basic steps: get the data, and symbolize it, often using one of its attribute fields. If the data did not contain the exact field you need, you could always contact the data’s creator and ask them, nicely, to create what you need. While that can work in certain circumstances, data owners cannot respond to increasing numbers of such requests.

The alternative: download the data, add/calculate the field you need, and host it yourself. Inefficient, but it works.  What if there were a better way?

ArcGIS Online now includes and utilizes Arcade expressions.  Arcade expressions, described in full here, allow you to make maps from simple calculations, from functions, from data conversions, and from brand new representations of your data.

Because Arcade expressions are calculated on the fly, you do not need to add a field or permanently calculate its values.  This makes it far easier to utilize the map layers and data already out there.

For example, my colleague hosted a dataset with fields representing samples of water quality in my local rivers. My manager wants to see the average contamination levels of the water samples, but the dataset does not contain a field with the average. Using a simple expression, I can calculate the average value directly within the Change Style window using the service’s attributes. Ta da! Done in seconds! I can immediately show my manager the new map, without any data management work.

Expressions harness the power of the Arcade expression language. Arcade provides a simple syntax to calculate values, apply functions to data, use logic statements like IF…THEN, convert data and more. In terms of mapping, use Arcade expressions to map the results of your function, create and map custom categories, set transparency based on an expression, or rotate symbols based on an expression.

To use expressions in ArcGIS Online, go to your layer’s “Change Style” button to start. In the list of attributes, scroll to the bottom and choose “New Expression” to define a new expression by which your map will be drawn.

A scripting window appears, alongside a list of the layer’s attributes and their aliases.

Let’s make a simple expression. Write a simple equation to calculate the value you want, and when you hit “Ok,” your map will now reflect the results of that calculation.

For example, I have found a dataset showing the population of adults, age 18 and over, in Dallas, Texas. However, I want to explore patterns for all youth (age < 18) in the area. I wish my dataset already had an attribute field called “AgeUnder18” or something like that, but it does not.

Instead, I simply calculate it. I double-click on the Total Population attribute, and then type the minus sign, and lastly I double-click on the “Population 18+” to complete the expression. I hit the “Test” button to verify that it generates a reasonable value for a sample record.

Simple expressions are needed for so many useful maps: maps that show percentages (when you were only given attributes with counts); maps that show summations of two or more counts; maps that just need basic math. Expressions are for anyone who can do basic math!

Equally exciting are the logic and functions available in Arcade expressions. You can create variables, use if statements, use equations, and many more things. If you’re comfortable writing expressions in Excel or statistics packages, you’ll love Arcade.

The following dataset contains information about prisoner figures for California. An expression was used to help create context about not only the number of prisoners, but also the relationship to capacity levels. Red locations are above capacity. Green locations are below capacity.

Expressions can also be used to set visual variables on the map, such as transparency of features, and the rotation of symbols.  The following map uses an expression to rotate symbols to show the increase or decrease of sales tax revenue in Texas cities:

Feel free to explore the settings used in maps shown in this blog in order to see examples of expressions in action. For these maps, and other maps using arcade expressions, visit the following Gallery. Also, look out for future blogs about more ways to utilize Arcade expressions in ArcGIS Online.

For documentation and a playground to help get started, visit the Arcade documentation page.

This entry was posted in ArcGIS Online, Cartographic Design, Developer, Mapping, Web and tagged , , , , , . Bookmark the permalink.

Leave a Reply


  1. johnmdye says:

    Wow! Thats awesome! Fantastic work! Can anyone answer if this will be available in Portal 10.5 or where it is on the roadmap to be added to Portal?

    • Lisa Berry says:

      Thank you John! You can author arcade expressions in Pro 1.4 and publish to a 10.5 portal. The 2D web clients will honor it, but you cannot edit or create new ones. Full support for Arcade will go out in 10.5.1.

  2. rkelso says:

    This is really cool. Great idea, great work! I’m sure arcade expressions are going to come in handy for me at some point in the near future. The place where I could jump in and take advantage right now would be if we could use this when configuring popups, particularly when creating a custom attribute display, but that does not appear to be implemented.

    • Lisa Berry says:

      Ryan, I’m glad that you will be able to take advantage of this powerful capability! Arcade will support pop-up customization in 2017, which will most likely come after the 10.5.1 release.

  3. keobrien_uncadmin says:

    We wrote a successful expression in an ArcGIS Online Map. The behavior of the hosted feature in the map worked as expected when edited in the map. We are doing field inspections of features on UNC at Chapel Hill’s campus using COLLECTOR. The hosted feature is symbolized on two values of an attribute. When the feature is inspected we want the inspected feature to turn a different color indicating it has been inspected. As I said this works very well in the AGO map viewer. However the hosted feature layer no longer displays in COLLECTOR once we applied the expression. When we removed the expression from the AGO map the hosted feature does display in COLLECTOR.

    Here is the expression:
    If ($feature.FEATURE == “BOLLARD”){
    If ($feature.DATE_INSPECTED>=1)
    “Bollard Done”

    Else {



    We have called ESRI Tech support and have an open case.

    • elizabethb_santarosagis says:

      Did you ever get an answer from ESRI Tech Support? I’m trying to do something similar and although it works in the web map, it will not work inside Collector…I can’t seem to find anything about this – is it a known issue with Collector?

  4. oldboy7075 says:

    Does anyone know whether this could be used in a web map in ArcGIS Online to symbolize unique values by more than one field, as in the desktop renderer? It doesn’t seem to be honored when publishing from desktop.

    • Lisa Berry says:

      oldboy7075, great question. You should be able to create an expression which reads the values of multiple fields and assigns unique values from these different fields. You’ll want to handle all possible combinations of the different fields when creating the assignments (each combination will need its own variable). For example, use an series of if/elseif statements to compare the values from the different fields, and then have it ‘return’ the desired naming based on which combination it is. It might look something like the prisoner map example above.

      • oldboy7075 says:

        Thanks Lisa, but I can’t seem to get anything to work in AGOL. Could you post a code snippet that would work in the style dialog GUI? Even when I just put in one field (say, $feature.ID1) which I could do straight through the GUI, it throws an ‘illegal value assignment’ error. I’ve tried quite a few variations with the same result. What would a functioning piece of code look like in the code box in AGOL? Thanks, cob

  5. mpl3win says:

    I notice that there is a new “Alias” profile mentioned in the Arcade docs. Could you please let me know a typical use case for this?

  6. atripp says:

    Hi Lisa – it looks like you have a lot of experience with Arcade. In your experience is it possible to develop range formulas in ArcGIS online? For example,

    For example, if I have the following data, a count oriented range formula would return the following “COUNTIF” field:

    Apple 2
    Apple 2
    Orange 1
    Banana 1

    Importantly, I’d like the count to adjust if the records are filtered. So in the above example if the second Apple record is filtered out, the count for Apple would revert to 1.

    Thanks in advance for your thoughts here.

  7. bhanu_v says:

    Hello Lisa,
    Great article !1
    Im using arcade expressions in a webmap for voting precints and curious to know if there is way to reference related table fields in the expression.
    In the configure attributes drop down you would find related records something like {relationships/0/NAME}.
    Is there a way to reference these from the globals in the scripting window.

    Any help will be appreciated

  8. u-kvick says:

    Hey Lisa!

    Nice blog! I wonder whether it is possible to render a color based on RGB values under three different fields (R, G, and B) for a feature class (Polygon) with arcade? is there a way to create an expression for this purpose?
    Best Regards,
    Felipe Verdú