labelingInfo

The labelingInfo object specifies the label definition for a layer.

Referenced by: drawingInfo, Feature Reduction Binning Drawing Info, Feature Reduction Cluster Drawing Info

Properties

Property Details
allowOverlapOfFeatureBoundary A string describing whether other labels are allowed to overlap this polygon feature's edge.
allow means that labels are allowed to overlap this polygon feature boundary. avoid means that labels that would overlap will move as much possible to minimize the overlap. exclude means that labels that would overlap are not placed.
Valid values:
  • allow
  • avoid
  • exclude
allowOverlapOfFeatureInterior A string describing how much other labels are allowed to overlap this feature.
allow means that labels are allowed to overlap this feature. avoid means that labels that would overlap will move as much possible to minimize the overlap. exclude means that labels that would overlap are not placed.
Valid values:
  • allow
  • avoid
  • exclude
allowOverlapOfLabel A string describing whether other labels are allowed to overlap this label.
allow means that labels are allowed to overlap this label. avoid means that labels that would overlap will move as much possible to minimize the overlap. exclude means that labels that would overlap are not placed.
Valid values:
  • allow
  • avoid
  • exclude
allowOverrun Specifies whether or not a label can overrun the geometry feature being labeled. Only applicable to labels for lines or polygons. If missing, then the default depends on the geometry of the feature: false for line feature geometries, and true for polygon feature geometries.
deconflictionStrategy Specifies the approach to use for deconflicting labels with this class against existing, more important, labels. The option 'none' uses the preferred position and can overlap existing labels and features. The option 'static' uses the preferred position but will not overlap existing labels or features. The option 'dynamic' will try to find a position to avoid overlap of labels and features. The option 'dynamicNeverRemove' will choose the position that minimizes overlap of labels and features but can overlap them if necessary.
Valid values:
  • dynamic
  • dynamicNeverRemove
  • none
  • static
fieldInfos[] An array of objects providing formatting information for the label field.
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.
labelExpression Read-only property specifying text for labels using simple expressions. Prefer to use labelExpressionInfo instead. This labelExpression property is only used if labelExpressionInfo is missing. An empty expression will result in no labels being created.
labelExpressionInfo Expression script object specifying the text that should be used as a label for each feature. This expression may combine information from the feature attributes with fixed strings. An empty expression will result in no labels being created. If this object isn't present then the labelExpression property will be used as a fallback.
labelPlacement Preferred position of the label with respect to its feature symbology. If missing, then the default depends on the geometry of the feature: esriServerPointLabelPlacementAboveRight for point feature geometries, esriServerLinePlacementAboveAlong for line feature geometries, and esriServerPolygonPlacementAlwaysHorizontal for polygon feature geometries.
Valid values: esriServerLinePlacementAboveAfter, esriServerLinePlacementAboveAlong, esriServerLinePlacementAboveBefore, esriServerLinePlacementAboveEnd, esriServerLinePlacementAboveStart, esriServerLinePlacementBelowAfter, esriServerLinePlacementBelowAlong, esriServerLinePlacementBelowBefore, esriServerLinePlacementBelowEnd, esriServerLinePlacementBelowStart, esriServerLinePlacementCenterAfter, esriServerLinePlacementCenterAlong, esriServerLinePlacementCenterBefore, esriServerLinePlacementCenterEnd, esriServerLinePlacementCenterStart, esriServerPointLabelPlacementAboveCenter, esriServerPointLabelPlacementAboveLeft, esriServerPointLabelPlacementAboveRight, esriServerPointLabelPlacementBelowCenter, esriServerPointLabelPlacementBelowLeft, esriServerPointLabelPlacementBelowRight, esriServerPointLabelPlacementCenterCenter, esriServerPointLabelPlacementCenterLeft, esriServerPointLabelPlacementCenterRight, esriServerPolygonPlacementAlwaysHorizontal
lineConnection Specifies the approach to use for connecting line labels with this class. The option 'none' specifies that line connection should not be performed. The option 'minimizeLabels' connects lines through intersections while 'unambiguousLabels' allows for labels on sides of intersections to clarify ambiguity with label and feature relationships.
Valid values:
  • minimizeLabels
  • none
  • unambiguousLabels
lineOrientation String specifying whether labelPlacement of Above (or Below) will be interpreted as Above (or Below) on the page, or with respect to the direction of line's geometry (that is, the digitization order in which the vertices are listed). If the lineOrientation is set to page, then labelPlacement of Above means the label will be offset perpendicularly from its line segment towards the top of the page. If the lineOrientation is set to direction, then labelPlacement of Above means the label will be offset perpendicularly left from its line segment. If the lineOrientation is set to unconstrained, then the label will be offset perpendicularly to whichever side of the line geometry has space (defaulting to Above, in the page sense). labelPlacement of Below would have the corresponding interpretations.
Valid values:
  • direction
  • page
  • unconstrained
maxScale Represents the maximum scale at which the layer definition will be applied.
minScale Represents the minimum scale at which the layer definition will be applied.
multiPart Specifies the approach to use for labeling parts and segments of geometries.
Valid values:
  • labelLargest
  • labelPerFeature
  • labelPerPart
  • labelPerSegment
name The name of the label class. May be used to identify members within a collection of label classes e.g. attached to a feature layer
offsetDistance Specification of the screen distance (in points) between the feature symbol geometry and an offset label.
priority The priority of the label class relative to other label classes. When there is not enough space on the map for all labels, important labels will be placed, at the expense of less important labels. Priorities should be positive with 0 being the most important and higher numbers being less important. If missing, the default depends on the geometry of the feature: 12 for point feature geometries, 15 for line feature geometries, and 18 for polygon feature geometries.
removeDuplicates Specifies whether or not to remove duplicates and if removing duplicate labels whether or not to do it within just this label class, within all labels of that feature type (e.g. point layers) or across all layers. The removeDuplicatesDistance is used when a value other than none is set.
Valid values:
  • all
  • featureType
  • labelClass
  • none
removeDuplicatesDistance The screen distance in points to remove duplicates within. The value 0 is a special value and indicates to remove duplicates for the entire extent.
repeatLabel A boolean value indicating whether or not to repeat the label along or across the feature. If true, the label will be repeated according to the repeatLabelDistance. If missing, the default depends on the geometry of the feature: false for point and polygon feature geometries, and true for line feature geometries.
repeatLabelDistance The repeat label distance used when repeatLabel is true. It represents a screen distance in points.
stackAlignment This string property indicates whether or not to derive stacking from the text symbol or have dynamic stacking based on the relative position of the label to the feature.
Valid values:
  • dynamic
  • textSymbol
stackBreakPosition This string property indicates whether a row of text should be broken before or after it exceeds the ideal length. If stacking is turned on we can insert a linebreak 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 will overrun for individual words larger than this count.
Valid values:
  • after
  • before
stackLabel A boolean value indicating whether or not to stack (i.e. insert linebreaks into) long labels for this label class. If missing, the default depends on the geometry of the feature: true for point and polygon feature geometries, and false for line feature geometries.
stackRowLength The ideal number of characters to place on a row of stacked text. This length guides the decision on when to break long text strings into separate rows. The linebreak will be inserted between words, not in the middle of a word, so rows may be longer or shorter than the ideal. Depending on stackBreakPosition, the break may be inserted before the breaking word, or after. stackRowLength values of one or higher will cause linebreaks to be added when a row will exceed this length. Values of zero will cause linebreaks to be added whenever possible i.e. after every word. Values less than zero will cause a default length to be used (currently 9 characters, but may vary by feature geometry type).
stackSeparators[] Array of which characters in a text label can indicate a line-break. By default, space and comma indicate optional linebreaks, and newline indicates a forced linebreak. If an empty array of stackSeparators is specified, then these default optional indicators are turned off. If any separator list, other than the two default optional separators, is specified then that list replaces the default list. If the user requires a mixture of default separators and custom separators, then they need to specify all of them.
symbol The text symbol used to label.
textLayout String describing, once the text is positioned, how the text should be oriented based on the feature geometry. If this property is present, it must be one of the following values:
  • followFeature
  • horizontal
  • perpendicular
  • straight

A value of followFeature will make the text curve to follow a line feature (e.g. road or river). A value of horizontal will make the text be written horizontally with respect to the page. A value of straight will make the text straight and angled depending on the feature geometry: (point) rotated by the specified angle, (line) placed at an angle that follows the line, (polygon) angled to represent the shape of the polygon. A value of perpendicular will make the text rotated 90 degrees clockwise from the angle it would have used for straight.
The default value is horizontal for labels attached to point and polygon features, and followFeature for labels attached to line features.
Valid values:
  • followFeature
  • horizontal
  • perpendicular
  • straight
useClippedGeometry Boolean value indicating whether label positioning should be based on the original unclipped geometry, or on the geometry after it has been clipped to the screen extent. Only applicable to labels for lines or polygons.
useCodedValues Boolean value indicating whether to display the coded values for the field names referenced from the labelExpression or labelExpressionInfo.value. Note that if an Arcade labelExpresionInfo.expression is being used, then useCodedValues is ignored, as Arcade scripts explicitly specify when to decode and encode values.
where SQL string template used to determine which features to label.

Example

{
  "labelExpression": "[ACRES]",
  "labelExpressionInfo": {
    "value": "{ACRES}"
  },
  "fieldInfos": [
    {
      "fieldName": "ACRES",
      "format": {
        "places": 2,
        "digitSeparator": true
      }
    }
  ],
  "useCodedValues": false,
  "maxScale": 0,
  "minScale": 0,
  "labelPlacement": "esriServerPointLabelPlacementAboveLeft",
  "symbol": {
    "color": [
      51,
      51,
      51,
      255
    ],
    "type": "esriTS",
    "haloSize": 0,
    "horizontalAlignment": "center",
    "rightToLeft": false,
    "angle": 0,
    "xoffset": 0,
    "yoffset": 0,
    "text": "",
    "rotated": false,
    "kerning": true,
    "font": {
      "size": 9.75,
      "style": "normal",
      "decoration": "none",
      "weight": "bold",
      "family": "Arial"
    }
  }
}

labelingInfo for text placed NE of point symbol Example

{
  "allowOverlapOfFeatureBoundary": "allow",
  "allowOverlapOfFeatureInterior": "allow",
  "allowOverlapOfLabel": "avoid",
  "allowOverrun": false,
  "deconflictionStrategy": "static",
  "labelExpression": "[description]",
  "labelExpressionInfo": {
    "value": "{description}",
    "expression": "$feature.description"
  },
  "labelPlacement": "esriServerPointLabelPlacementAboveLeft",
  "lineConnection": "none",
  "maxScale": 0,
  "minScale": 0,
  "multiPart": "labelPerPart",
  "name": "Factory Utility",
  "offsetDistance": 3,
  "priority": 15,
  "removeDuplicates": "none",
  "removeDuplicatesDistance": 0,
  "repeatLabel": false,
  "repeatLabelDistance": 0,
  "stackAlignment": "dynamic",
  "stackBreakPosition": "after",
  "stackLabel": true,
  "stackRowLength": 9,
  "stackSeparators": [
    {
      "breakPosition": "before",
      "forced": true,
      "separator": "|",
      "visible": false
    },
    {
      "breakPosition": "after",
      "forced": false,
      "separator": "-",
      "visible": true
    }
  ],
  "useCodedValues": false,
  "where": "",
  "symbol": {
    "color": [
      51,
      51,
      51,
      255
    ],
    "type": "esriTS",
    "haloSize": 0,
    "horizontalAlignment": "center",
    "rightToLeft": false,
    "angle": 0,
    "xoffset": 0,
    "yoffset": 0,
    "text": "",
    "rotated": false,
    "kerning": true,
    "font": {
      "size": 9.75,
      "style": "normal",
      "decoration": "none",
      "weight": "bold",
      "family": "Arial"
    }
  }
}

labelingInfo for text placed at angle around point symbol Example

{
  "allowOverlapOfFeatureBoundary": "allow",
  "allowOverlapOfFeatureInterior": "exclude",
  "allowOverlapOfLabel": "exclude",
  "deconflictionStrategy": "static",
  "labelAngleInfo": {
    "angleExpressionInfo": {
      "expression": "iif($feature.type == 11, $feature.SITE_ANGLE, 90-2*$feature['other angle'])",
      "title": "Geology dir (site)"
    },
    "rotationType": "arithmetic"
  },
  "labelExpression": "[description]",
  "labelExpressionInfo": {
    "value": "{description}",
    "expression": "$feature.description"
  },
  "labelPlacement": "esriServerPointLabelPlacementBelowRight",
  "maxScale": 0,
  "minScale": 0,
  "name": "Well",
  "priority": 12,
  "removeDuplicates": "none",
  "removeDuplicatesDistance": 0,
  "repeatLabel": false,
  "repeatLabelDistance": 0,
  "stackAlignment": "dynamic",
  "stackBreakPosition": "after",
  "stackLabel": true,
  "stackRowLength": 9,
  "textLayout": "perpendicular",
  "useCodedValues": false,
  "where": "",
  "symbol": {
    "color": [
      51,
      51,
      51,
      255
    ],
    "type": "esriTS",
    "haloSize": 0,
    "horizontalAlignment": "center",
    "rightToLeft": false,
    "angle": 0,
    "xoffset": 0,
    "yoffset": 0,
    "text": "",
    "rotated": false,
    "kerning": true,
    "font": {
      "size": 9.75,
      "style": "normal",
      "decoration": "none",
      "weight": "bold",
      "family": "Arial"
    }
  }
}

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