Skip To ContentArcGIS for DevelopersSign In Dashboard

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.

Sample search results