☀Everything Automotive, Tested & Explained Stories

ArcGIS Online Game Changer: Resurrecting Arcade Expressions

By

In the dynamic landscape of GIS technology, Esri's ArcGIS Online has emerged as a powerful platform, revolutionizing the way we create, share, and collaborate on spatial information. Among its suite of tools, Arcade, a lightweight, easy-to-learn scripting language, stands out for enabling advanced feature layer queries and enhancing web maps. Let's delve into Arcade's capabilities within the ArcGIS Online ecosystem, exploring how it empowers users to create sophisticated map expressions and interactive experiences.

Arcade, Esri's open-source, JavaScript-inspired language, is designed for map authoring, making it an invaluable tool for web app developers, map designers, and GIS professionals. This article will guide you through the world of Arcade expressions in ArcGIS Online, helping you unlock the full potential of map interaction and query customization.

Understanding Arcade Expressions

Arcade expressions are snippets of code that define how data in your ArcGIS Online feature layers should be displayed, queried, or symbolized. They offer unprecedented control over your maps, enabling you to create interactive and dynamic mapping experiences.

ArcGIS Urban 101 – Projects and Plans
ArcGIS Urban 101 – Projects and Plans
an open laptop computer sitting on top of a desk
an open laptop computer sitting on top of a desk
What's New in ArcGIS Online (December 2016)
What's New in ArcGIS Online (December 2016)

At its core, an Arcade expression is a short piece of code that takes inputs (attributes of features, current map extent, etc.) and returns an output (a string, number, Boolean, or a feature). This output can then be used to control the behavior of your maps, such as defining labels, pop-ups, or filter queries.

Why Use Arcade Expressions?

Arcade expressions cater to a wide range of mapping needs, including data visualization, interactive labeling, and complex querying. By harnessing the power of Arcade, you can:

How to Make a Relationship Map in ArcGIS Online
How to Make a Relationship Map in ArcGIS Online
ArcGIS Online Basemaps Styles Customization Using ArcGIS Vector Tile Editor
ArcGIS Online Basemaps Styles Customization Using ArcGIS Vector Tile Editor
Racing Arcade Game - Free CAD Drawings
Racing Arcade Game - Free CAD Drawings
  1. Create dynamic labels that change based on feature properties or map scale.
  2. _symbolize features based on attributes or spatial relationships._
  3. Design interactive maps with pop-ups that display based on user interactions.
  4. Filter feature layers to show or hide features based on complex queries.

Building Blocks of Arcade Expressions

Arcade expressions are composed of functions, operators, and expressions. Functions are like black boxes that take input(s) and provide an output. Operators help define relationships between values (e.g., +, -, *, /, ==, <, >), and expressions combine functions and operators to perform calculations or logical tests.

Here's a simple Arcade expression example: `length($feature.name)`. This expression calculates the length of a feature's 'name' attribute, demonstrating the use of a function (length()) and an operator (.).

Arcade in Action: Interactive Map Labels

One of Arcade's standout use cases is creating interactive map labels, allowing you to display feature attributes or perform calculations for clearer map communication.

ArcGis 3d Analyst/ ArcScene Animation of flood
ArcGis 3d Analyst/ ArcScene Animation of flood
arcgis
arcgis
Streamline Planning and Community Development
Streamline Planning and Community Development
a computer screen showing an image of a city with lots of different colored blocks and shapes
a computer screen showing an image of a city with lots of different colored blocks and shapes
Enterprise GIS System | Cloud-Native Geospatial Software | ArcGIS Enterprise
Enterprise GIS System | Cloud-Native Geospatial Software | ArcGIS Enterprise
ArcGIS Urban: An Introduction
ArcGIS Urban: An Introduction

For instance, consider a map layer showing parks in a city. With Arcade, you can create labels that display parks' area sizes dynamically, using the expression $feature.area_acres + ' acres'.

Labels Based on Feature Attributes

You can use Arcade expressions to display feature attributes directly in map labels. For example, to show a feature's 'Name' field, use the expression $feature.Name. Alternatively, if you want to display the first ten characters of the 'Name' field, you can employ the subString() function: subString($feature.Name, 1, 10).

Labels Based on Map Extent

Arcade also allows for creating scale-dependent labels. This is handy when you want to display more detailed information at larger scales. For example, you can create an Arcade expression that appends a feature's type (e.g., 'Park', 'Council Office') at scales larger than 5000:

Arcade
Arcade
ArcGIS Online Story Map Tour Basics Tutorial
ArcGIS Online Story Map Tour Basics Tutorial
Quick tips for mastering the ArcGIS StoryMaps builder
Quick tips for mastering the ArcGIS StoryMaps builder
four maps showing different areas in the united states, including major cities and roads that have been
four maps showing different areas in the united states, including major cities and roads that have been

`اشتهاب(socket($scale > 5000, 'Park', '')) + ' ' + $feature.Name`

Complex Querying with Arcade

Beyondlabels, Arcade expressions can be used to filter feature layers and create complex queries, enabling you to show or hide features based on intricate conditions.

To illustrate, let's imagine you're creating a map of a city's green spaces, and you want to show only the parks larger than 50 acres when the map scale is greater than 1000. The Arcade expression for this query would look like this:

`$feature.area_acres > 50 && $scale > 1000`

Querying Based on Spatial Relationships

Arcade can query features based on spatial relationships too, making it possible to create maps that highlight features intersecting or within a certain distance of each other. For instance, to find all the fire hydrants within 500 feet of a given point, you can use the following expression:

`distance($geometry, makePoint(-122.45, 37.74, SRID=4326)) <= 1609.34`

In conclusion, Arcade expressions in ArcGIS Online empower users to create sophisticated, interactive, and dynamic maps. Whether you're looking to enhance data visualization through intricate labels or seeking to perform complex querying, Arcade offers a wealth of possibilities. So go ahead, explore the extensive capabilities of Arcade, and elevate your mapping journey to new heights!