logo
API Documentation
Tutorials
Getting Started Initialization Layers Third party Controls Geometries Vector styles Measures InfoBox Utils
Releases

Documentation

Modules

  • Constants

Events

  • FEATURE_CLICK
  • FEATURE_HOVER
  • CENTER_DATE_IMAGE
  • CHANGE_MEASURE
  • CLICK
  • COMPLETE_COLLECTIONS
  • FEATURES_CLICK
  • FIND_IMAGES_LOADED
  • FINISH_MEASURE
  • MAP_INITIALIZE
  • MAP_STATUS_EVENT
  • MOVE_END
  • NO_3D_IMAGES
  • POINTER_MOVE
  • START_MEASURE
  • TILES_END_LOAD
  • TILES_START_LOAD
  • FEATURE_CLICK
  • FEATURE_HOVER

General

Classes / Controls

  • Bar
  • Button
  • Swipe
  • Toggle

Classes / Managers

  • CollectionManager
  • OverlayManager

Classes

  • Map

Classes / View

  • MapStatusView

Geometry

Classes

  • Extent
  • Feature
  • Line
  • Location
  • MultiPolygon
  • Point
  • Polygon

Classes / Readers

  • GeoJSON
  • WKT

InfoBox

Classes

  • InfoBox

Layers

Classes

  • ArcGISLayer
  • BingLayer
  • GroupLayer
  • ImageryLayer
  • OSMLayer
  • VectorLayer
  • VectorTileLayer
  • WFSLayer
  • WMSLayer
  • WMTSLayer
  • XYZLayer

Classes / Base Layers

  • BaseLayer
  • BaseVectorLayer

Measurements

Classes / Tools

  • CircleTool
  • HeightTool
  • LineTool
  • PointTool
  • PolygonTool
  • RectangleTool
  • RelativeHeightTool

Classes

  • Measure

Objects

Classes

  • Collection
  • CollectionStatus
  • Image
  • LayerCollections
  • LayerCollectionsStatus
  • MapStatus

Services

Classes

  • UserService

Styles

Classes

  • Circle
  • Fill
  • Icon
  • RegularShape
  • Stroke
  • Style
  • Text

Utils

Classes

  • Transform

Class

Text

Text(opts)

Set text style for vector features.

Learn more about implementing text styles in our Feature styles and Text styles tutorials.

Constructor

# new Text(opts)

Initialization object

Parameters:
Name Type Attributes Default Description
opts object

Options

font string <optional>

Font style as CSS 'font' value, see: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font. Default is '10px sans-serif'

maxAngle number <optional>
Math.PI/4

When placement is set to 'line', allow a maximum angle between adjacent characters. The expected value is in radians, and the default is 45° (Math.PI / 4).

offsetX number <optional>
0

Horizontal text offset in pixels. A positive will shift the text right.

offsetY number <optional>
0

Vertical text offset in pixels. A positive will shift the text down.

overflow boolean <optional>
false

For polygon labels or when placement is set to 'line', allow text to exceed the width of the polygon at the label position or the length of the path that it follows.

placement string <optional>
'point'

Text placement.

scale number <optional>

Scale.

rotateWithView boolean <optional>
false

Whether to rotate the text with the view.

rotation number <optional>
0

Rotation in radians (positive rotation clockwise).

text string <optional>

Text content.

textAlign string <optional>

Text alignment. Possible values: 'left', 'right', 'center', 'end' or 'start'. Default is 'center' for placement: 'point'. For placement: 'line', the default is to let the renderer choose a placement where maxAngle is not exceeded.

textBaseline string <optional>
'middle'

Text base line. Possible values: 'bottom', 'top', 'middle', 'alphabetic', 'hanging', 'ideographic'.

fill Fill <optional>

Fill style. If none is provided, we'll use a dark fill-style (#333).

stroke Stroke <optional>

Stroke style.

backgroundFill Fill <optional>

Fill style for the text background when placement is 'point'. Default is no fill.

backgroundStroke Stroke <optional>

Stroke style for the text background when placement is 'point'. Default is no stroke.

padding Array.<number> <optional>
[0, 0, 0, 0]

Padding in pixels around the text for decluttering and background. The order of values in the array is [top, right, bottom, left].

Tutorials:
  • Feature styles
  • Text styles

Classes

Text

Documentation generated by Vexcel Imaging