Labeling

The labeling profile allows the map author to write an expression that determines the label to show on the map for each feature. The script evaluates for each label as it is to be drawn. It is expected that the script returns a text value, comprising the label to be drawn.

Context

The following products implement this profile:

Spatial reference

The spatial reference of the map in which the expression executes determines the execution context's spatial reference.

Time zone

The time zone of the map in which the expression executes determines the execution context's default time zone.

Profile variables

Variable NameTypeDescriptionSince version
$featureFeatureThe feature whose label is to be drawn on the map.1.0
$viewDictionaryThe properties available from the view, as defined in the table below. Only supported in 2D MapViews.1.30

Properties of $view:

Variable NameTypeDescription
scaleNumberThe scale of the map at the time the expression evaluates.
timeProperties.currentStartDateThe start time of the map's time extent as indicated by a time slider component at the time the expression evaluates. This value dynamically updates (and may trigger the re-execution of the Arcade expression) when a time slider is used to update time-aware labels based on date field. A null value indicates the start time is inclusive since the beginning of time.
timeProperties.currentEndDateThe end time of the map's time extent as indicated by a time slider component at the time the expression evaluates. This value dynamically updates (and may trigger the re-execution of the Arcade expression) when a time slider is used to update time-aware labels based on date field. A null value indicates the end time is indefinite with no end.
timeProperties.startIncludedBooleanIndicates if the currentStart date is included in the map's current time extent.
timeProperties.endIncludedBooleanIndicates if the currentEnd date is included in the map's current time extent.

Function bundles

Core | Geometry

Return types

Text

Example

Calculates the associated compass direction of the wind based on the wind direction in degrees. Returns the wind speed, with units, and the calculated compass direction.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var DEG = $feature.WIND_DIRECT;
var SPEED = $feature.WIND_SPEED;
var DIR = When( SPEED == 0, '',
  (DEG < 22.5 && DEG >= 0) || DEG > 337.5, 'N',
   DEG >= 22.5 && DEG < 67.5, 'NE',
   DEG >= 67.5 && DEG < 112.5, 'E',
   DEG >= 112.5 && DEG < 157.5, 'SE',
   DEG >= 157.5 && DEG < 202.5, 'S',
   DEG >= 202.5 && DEG < 247.5, 'SW',
   DEG >= 247.5 && DEG < 292.5, 'W',
   DEG >= 292.5 && DEG < 337.5, 'NW',
   ''
);
var WIND = SPEED + ' mph ' + DIR;
return WIND;

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