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.
This profile was created for use in the following contexts:
|$feature||Feature||The feature whose label is to be drawn on the map.|
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.
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;