HOW TO
Arcade expressions can be used to write label expressions in ArcGIS Online web maps. It is possible to customize web map labels on a feature by feature basis using a simple conditional expression. This can be useful to differentiate features, for example, to give clarity to an urgent feature. The conditional syntax for Arcade expressions consists of 'if', 'else if', and 'else'. The condition is placed within parentheses, and the result is placed between curly brackets.
This article provides the steps to create custom labels using Arcade expressions in ArcGIS Online Map Viewer Classic.
For ArcGIS Online Map Viewer Classic
if ($feature.OBJECTID == 1) { return 'One' } else if ($feature.OBJECTID == 2) { return 'Two' }
The image below demonstrates the resulting label.
Alternatively, the script in Step 4 can also be modified to create custom labels to differentiate certain features. In the following example, only the feature with OBJECTID 1 is labeled with a text, and the remaining feature is labeled using the numeric OBJECTID value.
if ($feature.OBJECTID == 1) { return 'One' } else { return $feature.OBJECTID }
The image below demonstrates the resulting label.
For ArcGIS Online Map Viewer
if ($feature.OBJECTID == 1) { return 'One' } else { return $feature.OBJECTID }
if ($feature.OBJECTID == 1) { return 'One' } else { return $feature.OBJECTID }
Get help from ArcGIS experts
Download the Esri Support App