Frequently asked questions

Discover answers to commonly asked questions about ArcGIS Arcade.

Why was Arcade developed?

You may find yourself asking, "Why did Esri bother writing its own language when it probably could have used others, like Python?" This decision was made because we needed an expression language that met the following requirements:

  • Lightweight and simple - A language with a small number of functions and an easy syntax.
  • Portable - A language that can execute in multiple environments with the same syntax for web, desktop, and mobile apps.
  • Secure - A language that doesn't have security vulnerabilities that open the door to malicious scripts.
  • Geospatial first - A language that makes geospatial functions and capabilities first-class citizens.

Developing our own scripting language was the best option because other alternatives, such as Python and JavaScript, couldn't check all of the boxes above either due to language size, or their propensities for security issues.

Arcade is secure because it cannot be injected with executable code outside of its intended context. It is also portable and sharable; expressions can be authored in an app using one ArcGIS API, and understood by another without syntax differences. That means you can author an expression for labeling features in ArcGIS Online and that same expression will render labels consistently in ArcGIS Pro, the ArcGIS API for JavaScript, and any of the Runtime SDKs. Another benefit of Arcade is extensibility. The team at Esri can add functions specific to GIS applications, such as geometry calculations, to Arcade’s function library as use cases and demand drive the need for them.

Where can I use Arcade?

Arcade is solely intended for use within ArcGIS applications, ArcGIS Pro, ArcGIS Online Map Viewer, or the ArcGIS API for JavaScript. It is not a full-fledged programming language you can use to build apps. Expressions may only be executed within the context of a profile.

For example, in the context of the popup profile, Arcade can be used to calculate values client-side for a popup.

Use dark colors for code blocksCopy
      
1
2
3
4
5
6
// displays the % change between two attributes for the popup
var pop2020 = $feature.POP_2020;
var pop2010 = $feature.POP_2010;
var perChange = ( ( pop2020 - pop2010 ) / pop2010 );
// implicitly casts the number as a text value
return Round( perChange ) + "%";

See the Get started with Arcade page, Supported Products page, and other guide pages to learn more about when and where you can use Arcade.

Can I create my own Arcade profiles?

Yes, you can create your own Arcade profiles in the ArcGIS API for JavaScript and the ArcGIS Runtime SDKs. This is only available to developers building apps using the ArcGIS developer products. There are no apps that allow you to configure your own profiles. The following blog posts describe how you can create a custom profile.

What is the $ character used for?

The dollar sign $ character prefixes all profile variables. This helps the expression author know how to differentiate external inputs to the expression from variables declared within the expression.

Use dark colors for code blocksCopy
         
1
2
3
4
5
6
7
8
9
// $feature gives you access to attribute values
// so you can use them in calculations
$feature.POPULATION / $feature.SQ_MILES;

// $feature is a point geometry
var featureGeometry = Geometry($feature);

// returns the x-coordinate of the geometry
featureGeometry.x

See the Profile variables documentation for more information.

Where can I use geometry functions?

You can use geometry functions in any profile that includes the geometry function bundle. Keep in mind that some profiles, such as visualization, generalize geometries to improve performance. Therefore, geometry calculations will lose precision as geometries become more and more generalized (as you zoom out).

For example, calculating a the area of a parcel when zoomed out to the extent of a county will yield a less precise result than if you calculate the area of the same polygon when zoomed to the polygon's extent.

Can I use any function in any profile?

All functions included in the Core function bundle may be used in any profile. Functions packaged in other bundles are reserved for specific profiles.

How do I work with null values in popups?

There are several different ways to handle null values in your data. A common workflow is to remove or replace fields with empty values in a popup table. The IsEmpty() and DefaultValue() functions can help you handle these situations.

How do I reference data from a joined table?

Map services allow you to create dynamic table joins. Arcade can reference data in a joined table within a map service using the square bracket notation for field names: $feature["tableName.fieldName"].

Use dark colors for code blocksCopy
       
1
2
3
4
5
6
7
// Election data for 2016 in one table named "election2016"
// Election data for 2012 in another table named "election2012"
var demVotes2016 = $feature["election2016.VOTED_DEM"];
var demVotes2012 = $feature["election2012.VOTED_DEM"];

// returns % change in votes from 2012 to 2016
Round( ( ( demVotes2016 - demVotes2012 ) / demVotes2012 ) * 100, 2);

This example in the ArcGIS API for JavaScript demonstrates how this works.

See FeatureSetByRelationshipName.

Can I access data from other layers, web maps, or data sources?

Yes. You can access data from other layers using FeatureSet functions depending on the profiles that support them.

Can I use an Arcade expression outside script tags in a web app?

Yes. JavaScript treats Arcade expressions as string values, so you can write simple, one-line expressions as a string within a JavaScript file. You can also write and reference Arcade expressions in separate text files. Furthermore, you can use JavaScript to generate Arcade expressions dynamically in a web app. See the MapImageLayer - Explore data from a dynamic workspace sample for an example of this.

Why doesn't my expression work in my web app, but it does in ArcGIS Online?

An Arcade expression is portable as along as the functions and syntax used in it are supported in the versions of Arcade included in the apps executing the expression.

For example, you can create an Arcade expression for a popup in ArcGIS Online, which will always use the latest version of Arcade. However, the popup will not recognize the same expression if the web map or layer is loaded in an app built with an older of the ArcGIS API for JavaScript (such as 3.19) because that version uses Arcade 1.0, which doesn't include support for Arcade in popups.

Another example is $feature casting to Geometry in geometry functions. In Arcade version 1.4, the following expression is valid:

Use dark colors for code blocksCopy
 
1
Area( $feature, "kilometers" )

But it is not valid in Arcade version 1.3. Arcade 1.3 doesn't automatically cast a feature to a geometry, so you will need to cast the geometry yourself to ensure portability.

Use dark colors for code blocksCopy
 
1
Area ( Geometry($feature), "kilometers" )

Also note that geometry functions weren't supported until Arcade 1.3, so neither of the expressions will work if you attempt to use them in an app that uses Arcade 1.2 or prior.

To ensure portability, you should try to use apps including the latest version of Arcade where possible. You can find which versions of Arcade are used by each product/API in the Version matrix.

Where can I share my Arcade expressions with others?

You can publicly share Arcade expression templates with others in the Esri/arcade-expressions GitHub repository. This repository is intended for sharing and maintaining reuseable Arcade expressions across all supported profiles.

Can I work with two geometries that have different spatial references?

No. When working with multiple geometries using geometry functions, their spatial references must match. The spatial reference of all geometries must match the spatial reference of the map or service executing the expression as well.

Where can I find additional information on Arcade?

See the Your Arcade Questions Answered blog post.

Have any more questions about Arcade?

Please send us feedback or visit our support page.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.