Skip to content

Both copy text to your clipboard — Build with AI copies a setup prompt to paste into Claude Code, Cursor, Codex or Copilot; Copy page as Markdown copies this page to paste into a chat. How it works

MarkerOptions ​

MarkerOptions = object

Defined in: src/ui/marker.ts:23

The Marker options object

Properties ​

anchor? ​

optional anchor: PositionAnchor

Defined in: src/ui/marker.ts:41

A string indicating the part of the Marker that should be positioned closest to the coordinate set via Marker#setLngLat. Options are 'center', 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', and 'bottom-right'.

Default Value ​

ts
'center'

className? ​

optional className: string

Defined in: src/ui/marker.ts:31

Space-separated CSS class names to add to marker element.


clickTolerance? ​

optional clickTolerance: number

Defined in: src/ui/marker.ts:61

The max number of pixels a user can shift the mouse pointer during a click on the marker for it to be considered a valid click (as opposed to a marker drag). The default is to inherit map's clickTolerance.

Default Value ​

ts
0

color? ​

optional color: string

Defined in: src/ui/marker.ts:46

The color to use for the default marker if options.element is not provided. The default is light blue.

Default Value ​

ts
'#3FB1CE'

draggable? ​

optional draggable: boolean

Defined in: src/ui/marker.ts:56

A boolean indicating whether or not a marker is able to be dragged to a new position on the map.

Default Value ​

ts
false

element? ​

optional element: HTMLElement

Defined in: src/ui/marker.ts:27

DOM element to use as a marker. The default is a light blue, droplet-shaped SVG marker.


offset? ​

optional offset: PointLike

Defined in: src/ui/marker.ts:35

The offset in pixels as a PointLike object to apply relative to the element's center. Negatives indicate left and up.


opacity? ​

optional opacity: string

Defined in: src/ui/marker.ts:81

Marker's opacity when it's in clear view (not behind 3d terrain)

Default Value ​

ts
1

opacityWhenCovered? ​

optional opacityWhenCovered: string

Defined in: src/ui/marker.ts:86

Marker's opacity when it's behind 3d terrain

Default Value ​

ts
0.2

pitchAlignment? ​

optional pitchAlignment: Alignment

Defined in: src/ui/marker.ts:76

map aligns the Marker to the plane of the map. viewport aligns the Marker to the plane of the viewport. auto automatically matches the value of rotationAlignment.

Default Value ​

ts
'auto'

rotation? ​

optional rotation: number

Defined in: src/ui/marker.ts:66

The rotation angle of the marker in degrees, relative to its respective rotationAlignment setting. A positive value will rotate the marker clockwise.

Default Value ​

ts
0

rotationAlignment? ​

optional rotationAlignment: Alignment

Defined in: src/ui/marker.ts:71

map aligns the Marker's rotation relative to the map, maintaining a bearing as the map rotates. viewport aligns the Marker's rotation relative to the viewport, agnostic to map rotations. auto is equivalent to viewport.

Default Value ​

ts
'auto'

scale? ​

optional scale: number

Defined in: src/ui/marker.ts:51

The scale to use for the default marker if options.element is not provided. The default scale corresponds to a height of 41px and a width of 27px.

Default Value ​

ts
1

subpixelPositioning? ​

optional subpixelPositioning: boolean

Defined in: src/ui/marker.ts:92

If true, rounding is disabled for placement of the marker, allowing for subpixel positioning and smoother movement when the marker is translated.

Default Value ​

ts
false