This describes the general interface for a PointLabel style object.

An object literal containing placement instructions for point-based labels. All properties are optional.

Hierarchy

Properties

group?: string | number

The group name for this label style. This can be a custom name or the predefined constant: "NON_DECLUTTERED".

Labels that are painted with the same group name will automatically be decluttered, labels across different groups will not. The only exception to this is "NON_DECLUTTERED". When using this group, all labels inside this group will be painted without label decluttering. This parameter is optional. The default value is "DEFAULT". In practice, this means that - if no group is specified - all labels will be decluttered in the same group.

offset?: number | number[]

The amount by which the label should be offset with respect to its anchor location. This value describes the length in pixels of the vector that is added to the anchor location. If the given value is a number, then the label will be offset in the direction of the positioning. If an array of two numbers is given, then the label will be offset on each axis individually. The latter is not dependent on the position. Example: offset [5,3] will move the label 5 pixels to the right, and 3 pixels down.

padding?: number

The amount of padding that should be added around the label. This value describes the amount in pixels by which the labels extent should grow for the decluttering purpose. A negative number will be ignored. This parameter is optional. The default is no padding.

pin?: PinStyle

The pin style of the label. Leave this undefined if no pin should be added.

Defines the permitted positions when painting labels with this style. This can be any of the constant values defined from PointLabelPosition, or in case multiple positions are allowed a bitwise OR of these values or an array of them. If it is an array, the ordering represents the priority. For example the code below will allow the label to be positioned using either a NORTH or a SOUTH alignment.

  const labelStyle = {
positions: [PointLabelPosition.NORTH, PointLabelPosition.SOUTH]
};
priority?: number

Priority for this label style. A lower number means that the label will have a higher probability of being painted. If you do not explicitly assign a priority, the default priority of 0 is applied. The priority can be a negative number if you want to indicate that a label has a higher priority than the default.