ArcGIS Runtime SDK for .NET

JSON label class properties

The available properties for defining JSON label classes are described here, along with the expected values. Most of these properties are optional, so the default values applied are also described.

allowOverlapOfFeatureBoundary

Optional string describing whether other labels are allowed to overlap this feature's edge. Applies to polygons only.

ValuesDescription

allow

Labels are allowed to overlap this polygon feature boundary.

avoid

Labels that would overlap will move as much possible to minimize the overlap.

exclude

Labels that would overlap are not placed.

Default = allow

allowOverlapOfFeatureInterior

Optional string describing how much other labels are allowed to overlap this feature.

ValuesDescription

allow

Labels are allowed to overlap this feature.

avoid

Labels that would overlap will move as much possible to minimize the overlap.

exclude

Labels that would overlap are not placed.

Default = allow

allowOverlapOfLabel

Optional string describing whether other labels are allowed to overlap this label.

ValuesDescription

allow

Labels are allowed to overlap this label.

avoid

Labels that would overlap will move as much possible to minimize the overlap.

exclude

Labels that would overlap are not placed.

Default = allow

allowOverrun

Optional boolean to control whether a label will be visible at scales where the feature is too small for the label to fit.

ValuesDescription

true

Label can run past the ends of its line feature or edges or its polygon feature.

false

Label cannot run past the ends of its line feature or edges or its polygon feature.

Default = false

deconflictionStrategy

Optional string that identifies a strategy for avoiding overlap with point symbols or higher priority labels.

ValuesDescription

static

Place the label in the preferred location, unless it would overlap a higher priority label or point feature symbol. If it overlaps a lower priority label, then the lower priority label will disappear or move (depending on whether its deconflictionStrategy is static or dynamic).

none

Place the label in the preferred location, regardless of overlaps with other features or labels.

dynamic

Place the label in the preferred location, but move to alternative location to avoid overlapping higher priority labels or point feature symbols.

Default = static

labelAngleInfo

Optional object specifying how to position a label following the direction of an angle. These properties will be used if the expression is not empty. The labelPlacement will still be used to indicate whether offset or centered positioning is required, but the exact position will be given by the angle calculated for the feature. Once the position has been determined, textLayout and textOrientation are used to specify the layout of the text at that position.

The labelAngleInfo object specifies the angular positions and layout directions for labels on or around point feature symbols. This may be different for each feature (driven by one or more feature attributes) or constant for all features (specified by a fixed number).

Default = NULL

Example:

"labelAngleInfo": {
  "angleExpressionInfo": {
    "expression": "iif($feature.type == 11, $feature.SITE_ANGLE, 90-2*$feature['other angle'])",
    "returnType": "number"
  },
  "rotationType": "arithmetic"
}

labelAngleInfo.angleExpressionInfo

This expressionInfo object specifies how the angle (in degrees) for a label is calculated from the feature attributes. It may use attributes, fixed numbers, or a combination of both. If missing, an angle value of zero is assumed.

The object defines a script expression that can be used to compute values. The script may refer to external data which will be available when the expression is being evaluated.

labelAngleInfo.angleExpressionInfo.expression

Optional expression in the Arcade expression language. If no expression is provided, then the default (empty) expression produces a null, empty string, zero or false when evaluated (depending on usage and context). The expression describes how to calculate the rotation angle (in degrees) for a feature, often using attributes of the feature.

labelAngleInfo.angleExpressionInfo.returnType

Always number for the angleExpressioInfo usage.

labelAngleInfo.rotationType

Optional specification of whether the placement angle calculated by the angleExpressionInfo should be interpreted as arithmetic (counter-clockwise from East) or geographic (clockwise from North).

ValuesDescription

arithmetic

Rotation is counter-clockwise from East.

geographic

Rotation is clockwise from North.

Default = arithmetic

labelExpression

Optional expression describing how to build the text label for a feature, often using attributes of the feature. More information about the label expression can be found in the REST API Label class topic. If a Webmap or Arcade expression (labelExpressionInfo) is also provided, labelExpression is ignored.

Default = "" (an empty expression that results in no labels being generated)

Expression examples:

  • "You are here"—Fixed text is used as the label for every feature.
  • "[AreaName]"—The value of the AreaName attribute for each feature is used as the label.
  • "[StreetName] CONCAT " Street""—Append the StreetName attribute value with the text "Street" for each feature's label.

labelExpressionInfo

An optional object containing an Arcade or Webmap expression that describes how to label features.

labelExpressionInfo.expression

An optional Arcade expression describing how to build the text label for a feature, often using attributes of the feature. More information about building Arcade expressions can be found in the ArcGIS Arcade documentation.

Default = "" (an empty expression that results in no labels being generated)

Expression examples:

  • ""You are here""—Fixed text is used as the label for every feature.
  • "$feature.AreaName"—The value of the AreaName attribute for each feature is used as the label.
  • "$feature.StreetName + ' Street'"—Append the StreetName attribute value with the text "Street" for each feature's label.

labelExpressionInfo.value

An optional Webmap expression describing how to build the text label for a feature, often using attributes of the feature. This language allows embedding of the feature's attributes in a literal text string. If an Arcade expression (labelExpressionInfo.expression) is also provided, this expression is ignored.

Default = "" (an empty expression that results in no labels being generated)

Expression examples:

  • "You are here"—Fixed text is used as the label for every feature.
  • "{AreaName}"—The value of the AreaName attribute for each feature is used as the label.
  • "{StreetName} Street"—Append the StreetName attribute value with the text "Street" for each feature's label.

labelPlacement

An optional preferred position of the text label, with respect to its feature geometry.

ValuesDescription

esriServerPointLabelPlacementAboveCenter

Lower midpoint of label is offset North of point symbol.

esriServerPointLabelPlacementAboveLeft

Lower right corner of the label is offset North-west of point symbol.

esriServerPointLabelPlacementAboveRight

Lower left corner of the label is offset North-east of point symbol.

esriServerPointLabelPlacementBelowCenter

Upper midpoint of label is offset South of point symbol.

esriServerPointLabelPlacementBelowLeft

Upper right corner of the label is offset South-west of point symbol.

esriServerPointLabelPlacementBelowRight

Upper left corner of the label is offset South-east of point symbol.

esriServerPointLabelPlacementCenterCenter

Center of label is placed on geometry point.

esriServerPointLabelPlacementCenterLeft

Right midpoint of label is offset West of point symbol.

esriServerPointLabelPlacementCenterRight

Left midpoint of label is offset East of point symbol.

esriServerLinePlacementAboveAfter

Lower left corner of label is at final geometry coord, label extrapolates the last geometry segment.

esriServerLinePlacementAboveAlong

Lower midpoint of label prefers the midpoint of the geometry, label follows the geometry segments.

esriServerLinePlacementAboveBefore

Lower right corner of label is at first geometry coord, label extrapolates the first geometry segment.

esriServerLinePlacementAboveStart

Lower left corner of label is at first geometry coord, label follows the first geometry segments.

esriServerLinePlacementAboveEnd

Lower right corner of label is at final geometry coord, label follows the last geometry segments.

esriServerLinePlacementBelowAfter

Upper left corner of label is at final geometry coord, label extrapolates the last geometry segment.

esriServerLinePlacementBelowAlong

Upper midpoint of label prefers the midpoint of the geometry, label follows the geometry segments.

esriServerLinePlacementBelowBefore

Upper right corner of label is at first geometry coord, label extrapolates the first geometry segment.

esriServerLinePlacementBelowStart

Upper left corner of label is at first geometry coord, label follows the first geometry segments.

esriServerLinePlacementBelowEnd

Upper right corner of label is at final geometry coord, label follows the last geometry segments.

esriServerLinePlacementCenterAfter

Left midpoint of label is at final geometry coord, label extrapolates the last geometry segment.

esriServerLinePlacementCenterAlong

Center of label prefers the midpoint of the geometry, label follows the geometry segments.

esriServerLinePlacementCenterBefore

Right midpoint of label is at first geometry coord, label extrapolates the first geometry segment.

esriServerLinePlacementCenterStart

Left midpoint of label is at first geometry coord, label follows the first geometry segments.

esriServerLinePlacementCenterEnd

Right midpoint of label is at final geometry coord, label follows the last geometry segments.

esriServerPolygonPlacementAlwaysHorizontal

Center of label is as far inside polygon as possible.

Default depends on the geometry type of the feature:

  • Points = esriServerPointLabelPlacementAboveRight
  • Lines = esriServerLinePlacementAboveAlong
  • Polygons = esriServerPolygonPlacementAlwaysHorizontal

lineConnection

Optional string to control whether line features with the same label, and matching end vertices, should be joined before sharing a label.

ValuesDescription

minimizeLabels

Line geometries with the same label and coincident end vertices should be considered as a single geometry when placing labels.

unambiguousLabels

Line geometries with the same label and coincident end vertices should be considered as a single geometry when placing labels, until they hit a junction.

none

Keep one label per line feature geometry.

Default = minimizeLabels

maxScale

Limit the visibility of the labels to scales smaller than the value provided.

ValuesDescription

0

No maximum scale.

Number

Denominator of the largest scale at which labels are still visible.

Default = 0

minScale

Limit the visibility of the labels to scales larger than the value provided.

ValuesDescription

0

No minimum scale.

Number

Denominator of the smallest scale at which labels are still visible.

Default = 0

multiPart

How to handle labels for multipart polyline or polygon features.

ValuesDescription

labelLargest

If a line feature consists of multiple line geometries, or a polygon feature consists of multiple ring geometries, the largest one will be assigned a label.

labelPerPart

If a line feature consists of multiple line geometries, or a polygon feature consists of multiple ring geometries, each geometry will be assigned a label.

labelPerSegment

Not supported.

labelPerFeature

Not supported.

Default = labelPerPart

name

A text string to identify the label class, which may be presented in user interfaces where users interact with label classes.

Default = "" (no name for the label class)

offsetDistance

Optional specification of the screen distance (in points) between the feature symbol geometry and an offset label. This can be a negative value to pull the label closer to the feature.

Default = 1

priority

A number that controls which labels are placed first and can also supplant existing lower-priority labels.

ValuesDescription

-1

Automatic.

0

Most important.

5

High priority.

15

Moderate priority.

25

Low priority.

Higher values

Lowest priority.

Default = -1 The actual priority is calculated based on the geometry type:

  • Point features = 12
  • Line features = 15
  • Polygon features = 18

removeDuplicates

An optional setting to control how features with the same text are labeled. The distance that defines which labels are considered "nearby" is specified with the removeDuplicatesDistance setting.

ValuesDescription

none

No duplicate labels should be removed. Leave all the placed labels on the map regardless of nearby duplicates.

labelClass

Remove nearby duplicate labels if they belong to the same Label Class.

featureType

Remove nearby duplicate labels if they belong to the same Feature Type (point vs line vs polygon).

all

Remove nearby duplicate labels.

Default = none

removeDuplicatesDistance

Specifies the duplicate thinning radius (in points) to use with the removeDuplicates setting.

ValuesDescription

0

Special indicator value meaning infinity (the entire extent, in other words).

Number

Duplicate thinning radius distance in points.

Default = 0

repeatLabel

For line features, whether or not multiple copies of the label be placed for each feature.

ValuesDescription

true

Repeat the label along the feature.

false

Only place one label per feature.

Default = true for line geometry, false for points and polygons.

repeatLabelDistance

Indicate how dense the repeated labels are (in points). The distance is considered a guideline, the exact placement will be affected by the geometry and other nearby features and labels.

ValuesDescription

Number

Distance along the line feature in points, between the end of one repetition and the start of the next.

Default = 216 (in points, approximately 3 inches)

stackAlignment

Control the alignment of stacked label text.

ValuesDescription

dynamic

Set the alignment depending upon the label's position with respect to its feature. For example, a stack to the right of a point symbol will be left-aligned.

textSymbol

Follow the alignment specified in the text-symbol.

Default = textSymbol

stackBreakPosition

Controls whether a row of text should be broken before or after it exceeds the ideal length. If stacking is turned on, a line break can be inserted before or after the breaking word that overruns the maximum number of characters per row. Using the before option means rows will generally be shorter than the stackRowLength although they will overrun for individual words larger than this count.

ValuesDescription

before

Insert the line break before a word that will break the stackRowLength limit.

after

Insert the line break after a word that has broken the stackRowLength limit.

Default = after

stackLabel

Whether text should be stacked or wrapped, rather than placing long labels across the map.

ValuesDescription

true

Break long labels (more than 9 characters) and insert line breaks between words.

false

Do not change the label. If the label contains line breaks already, they will be honored.

Default = true for point and polygon features, false for line features

stackRowLength

The character limit for a row of text. A line break is inserted for the label when this limit is reached.

ValuesDescription

-1

Use default length.

0 or higher

Insert a line break when a row exceeds this number of characters.

Default = -1

stackSeparators

Optional specification of the separators that should be used for line breaks. These are defined with a list of LabelStackSeparator objects with the following properties:

ValuesDescription

separator

One character codepoint to look for in text string.

visible

Whether or not the separator character should be displayed if chosen as a line break position (true or false, default = false).

forced

Whether or not the separator should always be used as a line break position (true or false, default = false).

breakPosition

Break a line of text before or after it exceeds the ideal length (before or after, default = after).

Default separators = single space, comma, and hyphen

Example:

"stackSeparators": [{separator:" ",visible:true,forced:false,breakPosition:"after"},
                    {separator:";",visible:false,forced:false,breakPosition:"after"}]

symbol

The text symbol to use for displaying labels. In addition to familiar properties such as color and font, the text symbol can define things like offsets, alignment, rotation, and angle.

ValuesDescription

angle

A numeric value that defines the number of degrees (0 to 360) that a text symbol is rotated. The rotation is from East in a counter-clockwise direction where East is the 0° axis.

backgroundColor

Background color is represented as a four-element array. The four elements represent values for red, green, blue, and alpha in that order. Values range from 0 to 255. If color is undefined, the color value is null.

borderLineColor

Borderline color is represented as a four-element array. The four elements represent values for red, green, blue, and alpha in that order. Values range from 0 to 255. If color is undefined, the color value is null.

borderLineSize

The width of the border, in points.

color

Text color is represented as a four-element array. The four elements represent values for red, green, blue, and alpha in that order. Values range from 0 to 255. If color is undefined, the color value is null.

font

A font object that specifies the font used for the symbol. Font defines decoration, family, size, style, and weight properties.

haloColor

A color to display around the text as a halo. If color is undefined, the color value is null.

haloSize

The size of a halo to draw around the text, in points.

horizontalAlignment

One of the following values to define horizontal alignment of the text: left, right, center, justify.

kerning

A boolean to specify whether or not to adjust spacing between characters in the text.

rightToLeft

A boolean to specify whether or not to render text from right to left (for Arabic or Hebrew text, for example).

rotated

A boolean to specify whether or not every character in the text is rotated.

text

Text to render with the symbol. This is only applicable when specified as a symbol for a client-side graphic.

type

The type of symbol. Must be esriTS for a text symbol.

verticalAlignmet

One of the following values to define vertical alignment of the text: top, bottom, middle, baseline.

xoffset

The distance to offset the symbol along the x-axis, in points.

yoffset

The distance to offset the symbol along the y-axis, in points.

Example:
{
  "symbol": {
    "angle": 0,
    "backgroundColor": [
      0,
      0,
      0,
      0
    ],
    "borderLineColor": [
      255,
      0,
      255,
      255
    ],
    "borderLineSize": 2,
    "color": [
      78,
      78,
      78,
      255
    ],
    "font": {
      "decoration": "none",
      "family": "Arial",
      "size": 12,
      "style": "normal",
      "weight": "bold"
    },
    "haloColor": [
      0,
      255,
      0,
      255
    ],
    "haloSize": 2,
    "horizontalAlignment": "left",
    "kerning": true,
    "rightToLeft": false,
    "type": "esriTS",
    "verticalAlignment": "bottom",
    "xoffset": 0,
    "yoffset": 0
  }
}

textLayout

Optional specification of whether the label text should be written horizontally, straight in line with the (line) feature or (point) positioning angle, or perpendicular to the positioning angle.

ValuesDescription

automatic

Varies by geometry type. See the description of default behavior.

horizontal

Layout the text horizontally.

straight

Layout the text straight in line with the (line) feature or (point) positioning angle.

perpendicular

Layout the text perpendicular to the positioning angle.

Default = automatic, which results in:

  • horizontal for point feature labels.
  • straight for line feature labels.
  • horizontal for polygon feature labels.

textOrientation

Optional specification of whether text should follow the placement angle direction even if it means being rendered upside-down, or whether text should be flipped 180 degrees to keep it page-oriented.

ValuesDescription

direction

Text should follow the placement angle direction even if it means being rendered upside-down.

page

Text should be flipped 180 degrees to keep it page-oriented.

Default = page

useCodedValues

A boolean that controls whether the data source should translate domain identifiers into descriptions. This is only used for simple expressions, since it is ignored if an Arcade or Webmap expression is used. Arcade provides its own function for the user to specify decoding on demand.

ValuesDescription

true

Attributes are translated if they have domain mappings set up in the datasource.

false

Raw attributes are used.

Default = false

where

An expression to limit the visibility of labels in the label class.

Examples:

  • "CITY_NAME LIKE 'San%'"
  • "(POP2000 > 2000000) AND (CAPITAL = 'Y')"

Default = "" (empty string which means all labels in the class are displayed)