ArcGIS Arcade Examples: Master These Esri Scripts

By Katherine

Discovering the power of Esri's ArcGIS Arcade can greatly enhance your understanding and application of GIS data analysis. Arcade offers numerous functions for expressions, calculations, and data manipulation, providing a robust environment to engage with your data like never before. Let's dive into a few ArcGIS Arcade examples to demonstrate its capabilities and help you unleash its potential in your projects.

Urban & Regional Planning in Higher Education
Urban & Regional Planning in Higher Education

Before we delve into specifics, let's briefly recall what sets Arcade apart. Arcade expressions are user-defined functions that can be used in place of static values within map popups, labels, or even as Arcadeವಾಗaites. They enable complex, dynamic, and highly personalized calculation, leading to more detailed and insightful maps.

Arcade
Arcade

Arcade Basics: Data Manipulation

At the core of ArcGIS Arcade lies its ability to manipulate data. It helps extract insights from your data through various functions like arithmetic, logical, and string operations. Let's explore a few foundational Arcade examples:

THE ARCADE MANIA THE ULTIMATE COMBO ARCADE FOR RETRO GAMER
THE ARCADE MANIA THE ULTIMATE COMBO ARCADE FOR RETRO GAMER

Adding a new field to your feature class: Consider a feature class of parks with a 'Name' and 'Area' field. An Arcade expression can calculate and add a new field, 'SizeCategory', as follows:

var size = $feature.Area; // Calculate the area
if (size <= 100000) {
return "Small";
} else if (size <= 500000) {
return "Medium";
} else {
return "Large";
}}

Locations
Locations

In this instance, the Arcade expression categorizes park sizes based on their area, adding a new 'SizeCategory' field to help in visualizing and analyzing your data more effectively.

Date and Time Operations

Arcade expressions can also perform complex date and time operations, perfect for maintaining up-to-date maps or analyzing temporal data. Let's say you want to display the time remaining until a feature's 'ExpirationDate':

The Internet Arcade, A Large Collection of Coin-Operated Arcade Games Playable in a Web Browser
The Internet Arcade, A Large Collection of Coin-Operated Arcade Games Playable in a Web Browser

var daysRemaining = ($feature.ExpirationDate - new Date()).totalDays();
if (daysRemaining > 0) {
return "Expiring in " + daysRemaining + " days";
} else {
return "Expired";
}}

This Arcade example helps to visualize and track time-dependent features, enabling proactive management and decision-making.

Passing Parameters

an old computer game with hearts and numbers on the screen, which reads score ranking
an old computer game with hearts and numbers on the screen, which reads score ranking

Passing parameters in Arcade expressions allows for dynamic and adaptable calculations. For instance, let's create a Arcade expression that determines if a point is within a specified distance of a certain latitude and longitude:

var passedInLatitude = params.Latitude;
var passedInLongitude = params.Longitude;
var distanceUnit = params.DistanceUnit || "kilometers";
var distance = distance($feature, passedInLatitude, passedInLongitude, distanceUnit);
return "Distance: " + distance polskich[i] + " (" + distanceUnit + ")";

an arcade with neon lights and pool tables
an arcade with neon lights and pool tables
31 London Activity Bars / Games Bars & Arcades (2024)
31 London Activity Bars / Games Bars & Arcades (2024)
there is a photo of a drink machine on the wall
there is a photo of a drink machine on the wall
Continuous Arcade Learning Environment (CALE): Advancing the Capabilities of Arcade Learning Environment
Continuous Arcade Learning Environment (CALE): Advancing the Capabilities of Arcade Learning Environment
a poster with the words field id guide written in blue and pink on top of it
a poster with the words field id guide written in blue and pink on top of it
Arcade Website | Unique Web Designs | Gamer Designs | Arcade Aesthetic
Arcade Website | Unique Web Designs | Gamer Designs | Arcade Aesthetic
Pixel Art Arcade Square description
Pixel Art Arcade Square description
a drawing of a plan for a building with multiple sections and colors on the floor
a drawing of a plan for a building with multiple sections and colors on the floor
arcade
arcade
a drawing of a toilet with measurements
a drawing of a toilet with measurements

In this example, the Arcade expression calculates the distance from the input latitude and longitude, making it handy for on-the-fly analyses.

Intermediate ArcGIS Arcade: Symbolizing and Labeling

Arcade expressions can even control symbology and labeling within your maps, creating dynamic and personalized visualizations. Enhance your maps by manipulating symbol objects and values, demonstrating another powerful facet of Arcade's capabilities.

Consider a symbol object with a unique color for each 'Type' within your feature class. This Arcade expression sets the symbol's color based on the feature's 'Type' field:

var symbol = new SimpleMarkerSymbol();
symbol.style = "circle";
symbol.color = ($feature.Type === "Forest") ? [0, 200, 0, 1] : ($feature.Type === "Desert") ? [255, 200, 0, 1] : [0, 0, 255, 1];
return symbol;

Using Arcade to control symbology like this offers endless possibilities for creating visually engaging and informative maps.

Dynamic Labels

Arcade expressions also allow for dynamic labeling, far surpassing the capabilities of traditional 'Labeling' tools. For example, you can create labels that display multiple attributes, such as the feature's name and size category:

return $feature.Name + " (" + $feature.SizeCategory + ")";

This Arcade example combines the feature's 'Name' and 'SizeCategory' fields into a single label and can be adapted for even more complex labeling scenarios.

Conditional Formatting for Labels

Arcade expressions even support conditional formatting for labels. In this example, a feature's name will appear in bold if its area exceeds 100,000 square units:

var name = $feature.Name;
var weight = ($feature.Area > 100000) ? "bold" : "normal";
return {'text': name, 'weight': weight};

Applying conditional formatting to labels provides another layer of customization and helps draw attention to key features within your map.

By mastering these ArcGIS Arcade examples, you're equipped to leverage the full potential of this robust expression language, making your maps more engaging, informative, and adaptable. So go ahead, explore, experiment, and push the boundaries of what's possible with ArcGIS Arcade. Who knows what innovative and insightful map visualizations await your discovery?