Label Definition
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.getWhereClause() SQL constraint
What text should be displayed, based on the individual feature's attributes and the chosen LabelDefinition.getExpression() 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.getPlacement()
How to move or avoid other labels or features that would overlap each label
Constructors
Creates a LabelDefinition with the specified LabelExpression and TextSymbol.
Types
Functions
Properties
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).
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.
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.
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.
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.
The strategy for how many labels should be placed on each polyline or polygon (multi-ring) feature. The default is LabelMultipartStrategy.Automatic.
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.
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:
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.getRemoveDuplicatesStrategy() is enabled. The default value is 0. This indicates that duplicates should be removed from the entire extent.
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.
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.getRepeatStrategy() 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.
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.
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.getStackAlignment() property, the user can choose to use the TextSymbol.getHorizontalAlignment() 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.
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.getStackRowLength() (although will overrun for individual words larger than this count).
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.getStackBreakPosition(), the break may be inserted before the breaking word, or after.
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.
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.