top of page
Writer's pictureAndy Bohnhoff

Mastering Arcade in ArcGIS Pro and ArcGIS Online: Tips and Tricks for Better Maps and Insights

Arcade is an incredibly versatile scripting language within the ArcGIS ecosystem, enabling you to perform custom calculations, manipulate data, and create dynamic visualizations in both ArcGIS Pro and ArcGIS Online. From creating dynamic label expressions to customizing popup content, Arcade allows you to expand your GIS data displays in ways that are both informative and visually appealing. Here are some tips and tricks to get the most out of Arcade in your projects.


ArcGIS Esri

1. Using Arcade for Dynamic Label Expressions

Labels are a powerful tool in map-making, providing context without cluttering the map. Arcade offers the flexibility to create customized label expressions that go beyond the basics. Here’s how to use Arcade to display labels that adapt to your data:


  • Conditional Labels: Let's say you want to display different labels based on the type of road or landmark. With Arcade, you can write a conditional expression to adjust labels dynamically. Here’s an example expression that displays different label text based on the type of road:

var roadType = $feature.Road_Type;
if (roadType == "Highway") {
  return "HWY: " + $feature.Road_Name;
} else if (roadType == "Local") {
  return "Local Rd: " + $feature.Road_Name;
} else {
  return $feature.Road_Name;
}

This script checks the Road_Type attribute and applies different labels based on whether the road is a highway or a local road, giving users quick insights into road types.


  • Dynamic Units in Labels: If you have a layer showing distances or areas and want to automatically adjust the units, Arcade can help. This expression changes the units in labels based on the size of the area:

var area = $feature.Area;
if (area > 1000000) {
  return Round(area / 1000000, 2) + " sq mi";
} else {
  return Round(area, 2) + " sq ft";
}

This label expression is especially useful for maps with diverse feature sizes, like land parcels or administrative boundaries, allowing you to present information concisely.


2. Customizing Pop-ups with Arcade

Pop-ups in ArcGIS Online allow you to communicate complex information in an interactive way. With Arcade, you can make pop-ups more insightful by calculating values on the fly, displaying conditional content, or even formatting text.


  • On-the-Fly Calculations: This time, you’re mapping property data and want to show the price per square foot for each property. Instead of creating a new field, you can use Arcade to perform this calculation in the pop-up:

var price = $feature.Total_Price;
var area = $feature.Area;
if (area > 0) {
  return "$" + Text(price / area, "#,###.##") + " per sq ft";
} else {
  return "N/A";
}

This calculation checks that the area is greater than zero (to avoid division by zero) and then calculates and formats the price per square foot. It saves the effort of adding calculated fields to your dataset while still providing detailed insights.


  • Customize Charts, Graphs, and Icons: Let’s say you’re mapping population data for different age groups within a region. You want to display a bar chart within the pop-up that shows each age group’s population proportion. Start by creating an Arcade expression that calculates the values you need:

var young = $feature.Age_0_14;
var adult = $feature.Age_15_64;
var senior = $feature.Age_65_and_over;
return [young, adult, senior];

This expression returns an array of values that can then be used to generate a bar chart. In the pop-up configuration, you can add a Chart element that references this Arcade expression, specifying it as a bar chart with labeled categories, such as "Children," "Adults," and "Seniors." This creates a clear, visual representation of population distribution.


Esri Arcade ArcGIS Pro


3. Calculating New ArcGIS Fields Without Altering the Data

Arcade expressions can create virtual fields in ArcGIS Online or ArcGIS Pro that only exist in the map view without changing the source data. This feature is especially helpful when you need calculated values for analysis but don’t want to permanently alter your dataset.


  • Derive Annual Revenue: If you have data for monthly revenue but need annual revenue for analysis, you can use Arcade to sum the fields in real-time.

return $feature.Jan_Revenue + $feature.Feb_Revenue + $feature.Mar_Revenue + 
       $feature.Apr_Revenue + $feature.May_Revenue + $feature.Jun_Revenue +
       $feature.Jul_Revenue + $feature.Aug_Revenue + $feature.Sep_Revenue +
       $feature.Oct_Revenue + $feature.Nov_Revenue + $feature.Dec_Revenue;

This expression totals the monthly revenue fields dynamically, saving you the need to pre-calculate the annual sum. By keeping the calculation in the map layer rather than the dataset, you reduce clutter in your data schema.


  1. Data Transformation and Parsing

Arcade also allows you to manipulate text and numeric data directly, a feature that can be helpful for reformatting attributes for labels, pop-ups, or analysis.


  • Parsing and Formatting Text: Suppose your dataset has addresses in a single field, but you only want to display the city name. With Arcade, you can parse out this part of the address string:

var address = $feature.Address;
var splitAddress = Split(address, ",");
return splitAddress[1]; // Returns the city

This expression splits the address string at each comma and returns the second item (the city name), allowing you to create concise labels or popup information without needing to split the data manually.


Esri ArcGIS Pro Arcade


Conclusion

Arcade’s versatility brings a new level of customization to GIS work in ArcGIS Pro and ArcGIS Online. By combining data conversions, conditional formatting, and dynamic calculations, you can alter label expressions, pop-up content, symbology, and calculations to match your specific needs.


Arcade allows GIS professionals to unlock powerful, real-time insights without altering the underlying data, making it a valuable tool for both project customization and user engagement.

Comments


bottom of page