☀Everything Automotive, Tested & Explained Stories

ArcGIS Arcade Popup Examples: Enhance Your Maps

By

ArcGIS Arcade is a high-level scripting language designed to run on maps and data for the purpose of display logic, validation, and edits. When it comes to navigating through features, pop-ups in ArcGIS Arcade can greatly enhance your experience. Here's a comprehensive guide on how to create and customize pop-up examples in ArcGIS Arcade.

Before diving in, ensure you understand the basic syntax of Arcade, including variables, expressions, and control structures. Familiarize yourself with the division between Arcade expressions and Arcade script, as they are used differently in creating pop-ups.

Understanding Arcade Expressions and Scripts in Pop-ups

The primary difference between expressions and scripts in Arcade is that an expression returns a single value, while a script runs a block of code and can execute multiple statements.

ArcGIS Urban 101 – Projects and Plans
ArcGIS Urban 101 – Projects and Plans
ArcGIS Create A Map Layout
ArcGIS Create A Map Layout
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

Expressions are used in pop-ups to display data or perform calculations. For example, you can display a field's value as a label in the pop-up or calculate a value, like:

Expression Description
attributeToDisplay: $[AttributeName] Will display the value of an attribute of the currently hovered feature.
expressionWithCalculation: $[length] * 5 Will display the result of the calculation of the length of the currently hovered feature's geometry multiplied by 5.

Creating Arcade Expressions for Pop-up Labels

To create an Arcade expression for a pop-up label, use the following syntax:

What's New in ArcGIS Online (December 2016)
What's New in ArcGIS Online (December 2016)
Urban & Regional Planning in Higher Education
Urban & Regional Planning in Higher Education
Enterprise GIS System | Cloud-Native Geospatial Software | ArcGIS Enterprise
Enterprise GIS System | Cloud-Native Geospatial Software | ArcGIS Enterprise

label: $[Expression]

Creating Arcade Scripts for Pop-up Actions

In contrast, Arcade scripts are used for actions in pop-ups that involve running a block of code, such as opening a web page or sending an email. To create an Arcade script:

action: // Use a control structure like if, for, while, or repeat, along with other statements to run multiple lines of code. // For example, you might open a URL in the user's default web browser: window.open("https://www.example.com");

How To Add a Locator Map in ArcGis
How To Add a Locator Map in ArcGis
arcgis
arcgis
Arc GIS Tutorial: ArcMap
Arc GIS Tutorial: ArcMap
ArcGIS Urban: An Introduction
ArcGIS Urban: An Introduction
I will create gis map with arcmap, arcgis pro, qgis
I will create gis map with arcmap, arcgis pro, qgis
Understanding ArcGIS Pro
Understanding ArcGIS Pro

Sample Arcade Pop-ups in Action

Let's explore a few interactive Arcade pop-up examples that leverage both expressions and scripts.

Display a Calculated Value and Open a Web Page in a Pop-up

In this example, an Arcade expression calculates and displays the area of a feature in square kilometers, while an Arcade script opens a Wikipedia page for 'ArcGIS' when the user clicks on the "Learn More" button.

Gazetteer Layer Pop-up
Arcade Expressions Arcade Scripts
[FID] - $[FID] (No action)
Area: $[length * width ] square kilometers (No action)
(No additional fields) Learn More: action: window.open("https://en.wikipedia.org/wiki/ArcGIS");

Change Map Extent and Filter Records based on Pop-up Interaction

Here's an example where interacting with a pop-up action changes the map extent and filters other features on the map.

Portal for ArcGIS 101
Portal for ArcGIS 101
ArcGIS Online Story Map Tour Basics Tutorial
ArcGIS Online Story Map Tour Basics Tutorial
How to Add Data from ArcGIS Online to QGIS
How to Add Data from ArcGIS Online to QGIS
Layout preparation in Arc GIS and exporting in JPEG
Layout preparation in Arc GIS and exporting in JPEG

Arcade expression (for label): length($[Name])

Arcade script: map.setExtent(graphic.geometry Epidemiologic);

Additional expressions:

Change Map Extent Only: action: map.setExtent(graphic.geometry Epidemiologic);
Filter Records: action: filter( "Analytics", " Annette cuyo", "$[Name]" );

map.setExtent(graphic.geometry Epidemiologic);

ಮ್ಮ_stage1

Arcade offers a rich set of possibilities for enhancing your map's pop-up functionality. From displaying calculated values to executing complex actions, Arcade expressions and scripts enable you to create tailored, informative, and interactive experiences for your users. Always stay updated with the latest developments in Arcade, and keep exploring new ways to leverage this powerful tool in your mapmaking adventures.