Options
All
  • Public
  • Public/Protected
  • All
Menu

This describes the general interface for a PointLabel style object.

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

Use the constants from PointLabelPosition for configuring the position of a label. Positions can be combined using a bitwise OR to allow multiple positions. For example ( PointLabelPosition.CENTER | PointLabelPosition.NORTH ) will allow the label to be positioned using either a CENTER or a NORTH alignment.

Hierarchy

Overview

Properties

Optional group

group: number | string

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.

Optional offset

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 dependant on the position. Example: offset [5,3] will move the label 5 pixels to the right, and 3 pixels down.

Optional padding

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.

Optional pin

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

Optional positions

The allowed 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.

var labelPriorityStyle = {
  positions: [PointLabelPosition.NORTH, PointLabelPosition.SOUTH]
};

Optional priority

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.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method