LabelDefinition

An object that defines the text, appearance, and position of labels for features within a given scale range. A LabelDefinition describes a class of labels.

A collection of label definitions can be attached to a feature data source (example FeatureLayer). Each LabelDefinition specifies:

  • Which features are covered by the definition, by applying the LabelDefinition.whereClause SQL constraint

  • What text should be displayed, based on the individual feature's attributes and the chosen LabelDefinition.expression formula

  • How the text should appear, using the label definition's TextSymbol

  • Where the text should appear, with respect to its feature, using the LabelDefinition.placement

  • How to move or avoid other labels or features that would overlap each label

Since

200.1.0

Constructors

Link copied to clipboard
constructor(labelExpression: LabelExpression, textSymbol: TextSymbol?)

Creates a LabelDefinition with the specified LabelExpression and TextSymbol.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The angular positions and layout directions for labels on or around point feature symbols. This optional object specifies how to position a label following the direction of an angle. The angular position may be different for each feature (driven by one or more feature attributes) or constant for all features (specified by a fixed number).

Link copied to clipboard

The strategy for moving labels to avoid overlapping feature, annotation, dimension or graphic symbols or higher priority labels. In 3D LabelDeconflictionStrategy.Static is selected by default. The default is LabelDeconflictionStrategy.Automatic (which will be interpreted as LabelDeconflictionStrategy.Static i.e. use preferred location unless it would overlap an obstacle).

Link copied to clipboard

The expression script used to calculate the label text. The expression may be a combination of literal text and attribute values from the feature being labeled. The syntax of the expression is determined by which label expression object is used: ArcadeLabelExpression, SimpleLabelExpression or WebmapLabelExpression.

Link copied to clipboard

The strategy for whether other labels are allowed to overlap the boundary of polygon features/graphics being labeled by this LabelDefinition. In 3D scenes, labels will be allowed to overlap the boundaries of polygon features. The default is LabelOverlapStrategy.Automatic, which will give the same behavior as LabelOverlapStrategy.Allow.

Link copied to clipboard

The strategy for whether other labels are allowed to overlap the interior of polygon features/graphics being labeled by this LabelDefinition. In 3D scenes, labels will be allowed to overlap the interiors of polygon features. The default is LabelOverlapStrategy.Automatic which will give the same behavior as LabelOverlapStrategy.Allow.

Link copied to clipboard

The strategy for how to use the geometry of the feature when calculating the label position. Only applicable to labels for lines or polygons.

Link copied to clipboard

The strategy for whether other labels are allowed to overlap labels created by this LabelDefinition. In 3D, labels will not be allowed to overlap other labels. Overlapping labels will not be displayed until the user zooms in further so that the labels don't overlap. The default is LabelOverlapStrategy.Automatic which will give the same behavior as LabelOverlapStrategy.Exclude.

Link copied to clipboard

The strategy for whether line features with the same label, and matching end vertices, should be joined before sharing a label. 3D line features will be treated as independent features with their own label. The default is LabelLineConnection.Automatic, which will be interpreted as LabelLineConnection.MinimizeLabels.

Link copied to clipboard

The strategy for whether LabelDefinition.placement above or below a line geometry will be interpreted as above or below on the screen, or with respect to the direction of line's geometry (that is, the digitization order in which the vertices are listed). If the LabelDefinition.lineOrientation is set to LabelLineOrientation.Screen then LabelDefinition.placement above means the label will be offset perpendicularly from its line segment towards the top of the screen. If the LabelDefinition.lineOrientation is set to LabelLineOrientation.Direction then LabelDefinition.placement above means the label will be offset perpendicularly left from its line segment. If the LabelDefinition.lineOrientation is set to LabelLineOrientation.Unconstrained then the label will be offset perpendicularly to whichever side of the line geometry has space (defaulting to above in the screen sense). LabelDefinition.placement below would have the corresponding interpretations. The default is LabelLineOrientation.Screen.

Link copied to clipboard

The maximum scale at which labels will be visible. In 3D scenes,the scale range is between individual label and view plane instead of map and view plane. Labels will only be visible when the viewing scale is smaller than (or equal to) the maxScale.

Link copied to clipboard

The minimum scale at which labels will be visible. In 3D scenes, the scale range is between individual label and view plane instead of map and view plane. Labels will only be visible when the viewing scale is larger than (or equal to) the minScale.

Link copied to clipboard

The strategy for how many labels should be placed on each polyline or polygon (multi-ring) feature. The default is LabelMultipartStrategy.Automatic.

Link copied to clipboard

Text name for the class of labels. This name is assigned by the map author to clarify the purpose of this label definition. It is used for display or debugging purposes. If no name is explicitly assigned, then an empty text string is stored.

Link copied to clipboard

The distance (in points i.e. 1/72 inches) that text should be moved away from its features. The distance is measured from the point symbol radius or line feature symbology edge. The distance is measured on the screen (i.e. not in the map) in points, comparable to the text font size.

Link copied to clipboard

The strategy for whether a label will be visible at scales where the feature is too small for the label to fit. Not supported by 3D scenes. The default is LabelOverrunStrategy.Automatic which will give different behavior depending on the type of feature that the label might overrun.

Link copied to clipboard

The preferred position of the text label, with respect to its feature geometry. The default is LabelingPlacement.Automatic. The effect of this is the same as one of the following, depending on the type of feature geometry:

Link copied to clipboard

Defines which labels are placed first, and can also supplant existing lower-priority labels (e.g. during panning). Lower values indicate more important labels i.e.:

Link copied to clipboard

A value that controls the duplicate thinning radius (in points i.e. 1/72 inches). The distance is measured on the screen (i.e. not in the map) in points, comparable to the text font size. This value is only used if LabelDefinition.removeDuplicatesStrategy is enabled. The default value is 0. This indicates that duplicates should be removed from the entire extent.

Link copied to clipboard

The strategy for whether labels are removed if other features have the same text label. This can reduce clutter and free up space. The default is LabelRemoveDuplicatesStrategy.Automatic, which will be interpreted as LabelRemoveDuplicatesStrategy.None indicating that all labels should be shown if possible.

Link copied to clipboard

The distance apart (in points i.e. 1/72 inches) that the repetitions should be. In 3D scenes, only one label will be placed per line feature. This value is only used if LabelDefinition.repeatStrategy is enabled. The distance is measured on the screen along the line feature. As the user zooms in closer, two repetitions move further apart on the screen, until there is room for a new repetition between them. The default is 216 points i.e. line labels should be repeated approximately every 3 inches along long features.

Link copied to clipboard

The strategy for whether a label should have multiple copies created and placed along or across the same feature. In 3D scenes, only label will be placed per line feature. The default is LabelRepeatStrategy.Automatic.

Link copied to clipboard

The strategy for how multi-row (stacked) text should be aligned. Multi-row text labels can be horizontally aligned on the left, right or at its center. This preference can be specified by the TextSymbol assigned to the LabelDefinition. By using the LabelDefinition.stackAlignment property, the user can choose to use the TextSymbol.horizontalAlignment property for all labels, or can choose to have the most aesthetic alignment calculated case-by-case for each label depending on its placement position around its feature. This is particularly useful for labels of dense point features, where labels may move above, below, left or right of their point symbol, in order to fit on the display.

Link copied to clipboard

The strategy for whether a row of text should be broken before or after it exceeds the ideal length. If stacking is turned on, label placement can insert a line break before or after the word that overruns the maximum number of characters per row. Using the LabelStackBreakPosition.Before option means rows will generally be shorter than the LabelDefinition.stackRowLength (although will overrun for individual words larger than this count).

Link copied to clipboard

A value that limits the number of characters in a row of stacked text. This length guides the decision on when to break long text strings into separate rows. The line break will be inserted between words, not in the middle of a word, so rows may be longer or shorter than the ideal. Depending on LabelDefinition.stackBreakPosition, the break may be inserted before the breaking word, or after.

Link copied to clipboard

The stack separators that should be used for automatic line breaking of label text. Each LabelStackSeparator specifies a code point to be looked for in the text. A code point is often thought of as a single character in the text, but may need several chars in a String to describe it. So each LabelStackSeparator.separator is a String intended to describe one code point.

Link copied to clipboard

The strategy for whether the text should be stacked or wrapped, rather than placed as long trailing labels across the map. This property controls whether stacking is allowed, or not, or should be calculated automatically based on feature type. The default is LabelStackStrategy.Automatic, meaning that stacking will be enabled for point and polygon features and disabled for line features.

Link copied to clipboard

The layout of the text, which can be either horizontal, straight, perpendicular, or follow the line feature. Optional specification of whether, once the text is positioned, it should be written:

Link copied to clipboard

The orientation of the text, which can be either angle direction or screen-oriented. Not supported by 3D scenes. 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 through 180 degrees to keep it screen-oriented. This setting will take effect whenever the feature geometry determines that the text is angled upside-down, or if the map is rotated within the screen to make the text upside-down (with respect to the screen). The default is LabelTextOrientation.Automatic, which is interpreted as LabelTextOrientation.Screen.

Link copied to clipboard

The text symbol which describes the overall appearance of label text (e.g. font and size). If no LabelDefinition.textSymbol has been set, then no labels can be created.

Link copied to clipboard

Specifies whether the data source should translate domain identifiers into meanings using a CodedValueDomain. For any translation to occur, the data source must have one or more CodedValueDomain s set up for the attribute fields. The default value is true i.e. translation will be done.

Link copied to clipboard

A SQL where clause expression that limits the set of features for which labels will be generated and placed. This is a SQL where clause that can refer to the attributes of the feature. For example:

Inherited functions

Link copied to clipboard
open override fun toJson(): String

Convert an object to JSON string.