Label features using Arcade expressions

This sample demonstrates how to label features in a FeatureLayer using an Arcade expression. Arcade is a simple, lightweight scripting language that can evaluate expressions at runtime. You can access feature attributes within Arcade using the $feature profile variable. For example, to label cities with a CITY_NAME field, you can do so in the following manner: $feature.CITY_NAME. Arcade provides a series of built-in functions that allow you to perform mathematical calculations and logical operations within your expression. The final line of the expression must evaluate to a string or a number.

For example, this sample uses the When() function to reclassify wind direction values to either N, NE, E, SE, S, SW, W, or NW. The final line of the wind direction expression is returned as the label text. To read more details about Arcade and its syntax, see the Arcade guide page.

See the Labeling guide page for more information and known limitations.

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

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close