You are using a browser that is no longer supported. Please use the latest version of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. For more information please see the System Requirements.

Unsupported browser

You are using a browser that is not supported. JavaScript API works on the latest versions of Google Chrome, Mozilla Firefox, Apple Safari, or Microsoft Edge. Use one of these browsers and provide your feedback through GeoNet, the Esri Community.

  • {i18n.unsupportedBrowser.chrome}
  • Firefox
  • Safari
  • undefined
Loading...

Note: Support for 3D on mobile devices may vary, view the system requirements for more information.

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 global 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.

Sample search results

TitleSample
Loading...