For AI agents: a documentation index is available at /llms.txt. Markdown versions of all pages are available by appending .md to any URL.
Class MarkerMaptiler
Hierarchy (View Summary)
- MLMarker
- Marker
Index
Constructors
Properties
Accessors
Methods
Constructors
Maptilerconstructor
Creates a marker from a pre-built DOM or SVG element.
shape/sizedon't apply. Color/shadow options still apply as CSS custom properties for the element's own styles to consume.Parameters
- options: MapTilerMarkerElementOptions
Returns Marker
Creates a marker styled via the built-in SVG system (
shape,size, colour tokens, shadow). With no options, uses the default appearance.Parameters
Optionaloptions: MapTilerMarkerSVGOptions
Returns Marker
Properties
Maptiler[MarkerElementSymbol]
The DOM element *
Maptiler[MeasuredElementSizeSymbol]
Unscaled CSS pixel size of a custom element, measured once at registration. null until measured; unused for built-in SVG markers.
Maptiler[PendingUpdatesSymbol]
Property updates waiting to be flushed to the DOM on the next animation frame.
Readonly Maptilerid
UUID that uniquely identifies this marker instance.
Readonly Maptileroptions
Construction-time options snapshot — not updated by setters.
Accessors
MaptilerclassList
- get classList(): DOMTokenList
The
classListof the marker's wrapper element — the inner transform wrapper of a built-in marker, or the customelementitself. Read-only reference; add and remove classes through the returned list.Returns DOMTokenList
Methods
Maptiler[ApplyAltitudeFrameSymbol]
Per-frame altitude hook, called by MarkerManager for every altitude-active marker. Returns the elevated point's camera depth (used to rank z-index among altitude-active markers), or
nullwhen off-screen/behind the camera.Parameters
- projectionData: CustomLayerProjectionData
- map: Map
Returns number | null
Maptiler[ApplyCollisionDisplayStateSymbol]
Applies the collision engine's display-state decision.
Every transition fades. Hide/show fade in place; visible<->minimized fades through zero (dip out, swap at the invisible midpoint, fade back in).
Parameters
- state: MarkerCollisionDisplayState
Returns void
Maptiler[AttachToMapSymbol]
Attaches the marker to a map, and plays the configured
enteranimation (if any) once attached. Called only byMarkerManagerduring registration.Parameters
- map: Map
Target map instance.
Returns this
- map: Map
Maptiler[ClearFocusStateSymbol]
Blurs the marker's focusable element. Called by MarkerManager on map
click.Returns void
Maptiler[CollisionFootprintSymbol]
Resolves the marker's screen footprint for collision detection. Always full-size, even minimized.
Returns MarkerFootprint
Maptiler[DetachFromDOMSymbol]
Removes the marker from the DOM directly, bypassing MarkerManager.
Returns void
Maptiler[EmitCollisionDiffSymbol]
Fires the collision transition event (
markeroverlap/markerproximity).Parameters
- data: MarkerCollisionEventData
Returns void
Maptiler[FlushDOMUpdatesSymbol]
Applies all pending property updates to the marker element and clears the batch. Called by MarkerManager on the next animation frame.
Returns void
Maptiler[RefreshAdaptiveColorSymbol]
Queues re-resolving every unset colour against the current map style.
Returns void
addClassName
MaptileraddTo
Adds the marker to a map. Equivalent to
map.addMarker(marker), which it delegates to.Parameters
- map: Map
Target map instance.
Returns this
- map: Map
Maptilerfire
MaptilergetAltitude
MaptilergetAltitudeReference
Returns what getAltitude's meters are measured from. Defaults to
"ground".Returns AltitudeReference
MaptilergetCollisionDisplayState
Returns how the collision engine is currently displaying this marker.
Returns MarkerCollisionDisplayState
MaptilergetContent
Returns the current content string.
Returns string | undefined
MaptilergetContentColor
Returns the content colour currently in effect — the explicit
contentColor, else the default for the map's style.Returns string
MaptilergetDebug
Returns whether the debug overlay is currently enabled.
Returns boolean
getElement
MaptilergetInnerColor
Returns the inner area colour currently in effect — the explicit
innerColor, else the default for the map's style.Returns string
getLngLat
Get the marker's geographical location.
The longitude of the result may differ by a multiple of 360 degrees from the longitude previously set by
setLngLatbecauseMarkerwraps the anchor longitude across copies of the world to keep the marker on screen.Returns LngLat
A LngLat describing the marker's location.
getOffset
MaptilergetOuterColor
Returns the outer body colour currently in effect — the explicit
outerColor, else the default for the map's style.Returns string
MaptilergetOutline
Returns the current outline value (
true, a pixel width, orundefined).Returns number | true | undefined
MaptilergetOutlineColor
Returns the outline stroke colour currently in effect — the explicit
outlineColor, else the default for the map's style.Returns string
getPitchAlignment
Returns the current
pitchAlignmentproperty of the marker.Returns Alignment
The current pitch alignment of the marker in degrees.
getPopup
MaptilergetPriority
Returns the current rendering priority, or
undefinedif never set.Returns number | MarkerPriorityExpression | undefined
MaptilergetRotation
Returns the current inner-shell rotation in degrees.
Returns number
Rotation in degrees;
0if never set.
getRotationAlignment
Returns the current
rotationAlignmentproperty of the marker.Returns Alignment
The current rotational alignment of the marker.
MaptilergetScale
Returns the current 2-D scale. Defaults to
[1, 1].Returns Vector2 | undefined
MaptilergetShadow
Returns the current shadow preset, or
undefinedif none is set.Returns MapTilerMarkerShadow | undefined
MaptilergetShape
Returns the current shape, or
undefinedif never set.Returns MapTilerMarkerShape | undefined
MaptilergetSize
Returns the current size, or
undefinedif never explicitly set.Returns MapTilerMarkerSize | undefined
MaptilergetTitle
Returns the current title string.
Returns string | undefined
MaptilergetTransitions
Returns a copy of the currently configured per-property transitions.
Returns MapTilerMarkerTransitions
MaptilerhasActiveAltitude
isDraggable
Returns true if the marker can be dragged
Returns boolean
True if the marker is draggable.
listens
Returns a true if this instance of Evented or any forwardeed instances of Evented have a listener for the specified type.
Parameters
- type: keyof MarkerEventType
The event type
Returns boolean
trueif there is at least one registered listener for specified event type,falseotherwise- type: keyof MarkerEventType
Maptileroff
- off<T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)>(
type: T,
listener: (ev: MarkerEventTypeSDK[T]) => void,
): thisRemoves an event listener previously added with Marker.on or Marker.once. Accepts the MapLibre events as well as the SDK events (see MaptilerMarkerEventType).
Type Parameters
- T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)
Parameters
- type: T
- listener: (ev: MarkerEventTypeSDK[T]) => void
Returns this
Maptileron
- on<T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)>(
type: T,
listener: (ev: MarkerEventTypeSDK[T]) => void,
): SubscriptionAdds a listener for events of a specified type. Accepts the MapLibre events as well as the SDK events (see MaptilerMarkerEventType).
Type Parameters
- T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)
Parameters
- type: T
- listener: (ev: MarkerEventTypeSDK[T]) => void
Returns Subscription
Maptileronce
- once<T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)>(
type: T,
): Promise<MarkerEventTypeSDK[T]>Adds a listener that will be called only once to a specified event type. Accepts the MapLibre events as well as the SDK events (see MaptilerMarkerEventType).
Type Parameters
- T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)
Parameters
- type: T
Returns Promise<MarkerEventTypeSDK[T]>
- once<T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)>(
type: T,
listener: (ev: MarkerEventTypeSDK[T]) => void,
): thisAdds a listener that will be called only once to a specified event type.
The listener will be called first time the event fires after the listener is registered.
Type Parameters
- T extends (keyof MarkerEventType) | (keyof MaptilerMarkerEventType)
Parameters
- type: T
The event type to listen for.
- listener: (ev: MarkerEventTypeSDK[T]) => void
The function to be called when the event is fired the first time.
Returns this
thiswhen a listener is provided
Maptilerremove
Removes the marker, playing the configured
exitanimation first (if any) before detaching from the DOM.Returns this
removeClassName
MaptilersetAltitude
Sets altitude in meters above the ground plane (negative is fine — below ground/sea level), faked via a per-frame pixel offset.
options.relativeTo(default"ground") picks what the meters are measured from. There is deliberately no fast path formeters: 0: MapLibre's native marker position is already terrain-elevated whenever the map has terrain, so doing nothing at0would leave the marker on the terrain, not at ground/sea level.Pass
falseto unset: deregisters and clamps to MapLibre's own native (terrain-aware) position, same as a marker that never called this.Parameters
- meters: false
Altitude in meters, measured per
options.relativeTo, orfalseto unset altitude entirely.
Returns this
- meters: false
Sets altitude in meters above the ground plane (negative is fine — below ground/sea level), faked via a per-frame pixel offset.
options.relativeTo(default"ground") picks what the meters are measured from. There is deliberately no fast path formeters: 0: MapLibre's native marker position is already terrain-elevated whenever the map has terrain, so doing nothing at0would leave the marker on the terrain, not at ground/sea level.Pass
falseto unset: deregisters and clamps to MapLibre's own native (terrain-aware) position, same as a marker that never called this.Parameters
- meters: number
Altitude in meters, measured per
options.relativeTo, orfalseto unset altitude entirely. Optionaloptions: SetAltitudeOptionsSee SetAltitudeOptions. Ignored when
metersisfalse.
Returns this
- meters: number
MaptilersetContent
Sets the text content displayed inside the marker body.
Parameters
- content: string | undefined
Label string, or
undefinedto clear.
Returns void
- content: string | undefined
MaptilersetContentColor
Sets the colour applied to the marker content (icon, text, etc.).
Parameters
- color: string | undefined
Any valid CSS colour string, or
undefinedto return to the map-style default.
Returns void
- color: string | undefined
MaptilersetDebug
Shows or hides the debug overlay, which renders the marker's bounding box and center point on top of the marker element.
Parameters
- debug: boolean | undefined
trueto show the overlay,false/undefinedto hide it.
Returns void
- debug: boolean | undefined
setDraggable
Sets the
draggableproperty and functionality of the marker. A draggable default marker is also keyboard focusable and movable with the arrow keys (see MarkerOptions.draggable); custom marker elements keep their focusability and keyboard behavior application-owned.Parameters
OptionalshouldBeDraggable: booleanTurns drag functionality on/off
Returns this
setEventedParent
- setEventedParent(
parent?: Evented<EventTypeMap> | null,
data?: EventedParentData | (() => EventedParentData),
): thisBubble all events fired by this instance of Evented to this parent instance of Evented.
Parameters
Optionalparent: Evented<EventTypeMap> | nullOptionaldata: EventedParentData | (() => EventedParentData)
Returns this
MaptilersetGroundLine
Toggles a dashed line from the marker down (or up) to its ground point. Off by default. See
.maptiler-marker-groundlinein the SDK stylesheet and GroundLineOptions.className.Parameters
- enabled: boolean
Whether to show the line.
- options: GroundLineOptions = {}
Optional extra CSS class for styling.
Returns this
- enabled: boolean
MaptilersetInnerColor
Sets an explicit fill colour for the inner area of the marker, replacing the map-style default.
Parameters
- color: string | undefined
Any valid CSS colour string, or
undefinedto return to the map-style default.
Returns void
- color: string | undefined
MaptilersetLngLat
MaptilersetOffset
Sets the marker's screen-space pixel offset. Composes with altitude (see writeOffset) rather than replacing it.
Parameters
- offset: PointLike
Offset in pixels (+y down).
Returns this
- offset: PointLike
setOpacity
Sets the
opacityandopacityWhenCoveredproperties of the marker. When called without arguments, resets opacity and opacityWhenCovered to defaultsParameters
Optionalopacity: string | numberSets the
opacityproperty of the marker.OptionalopacityWhenCovered: string | numberSets the
opacityWhenCoveredproperty of the marker.
Returns this
MaptilersetOuterColor
Sets the fill colour of the outer body of the marker.
Parameters
- color: string | undefined
Any valid CSS colour string, or
undefinedto return to the map-style default.
Returns void
- color: string | undefined
MaptilersetOutline
Sets the outline stroke width on the marker body.
Parameters
- outline: number | true | undefined
truefor the default width, a positivenumberfor an explicit pixel width, orundefinedto remove the outline.
Returns void
- outline: number | true | undefined
MaptilersetOutlineColor
Sets the stroke colour of the marker outline. Has no visible effect unless setOutline is also called.
Parameters
- color: string | undefined
Any valid CSS colour string, or
undefinedto return to the map-style default.
Returns void
- color: string | undefined
setPitchAlignment
Sets the
pitchAlignmentproperty of the marker.Parameters
Optionalalignment: AlignmentSets the
pitchAlignmentproperty of the marker. If alignment is 'auto', it will automatically matchrotationAlignment.
Returns this
setPopup
Parameters
Optionalpopup: PopupMLGL | null
Returns this
MaptilersetPriority
Sets the rendering priority.
Parameters
- priority: number | MarkerPriorityExpression | undefined
Numeric priority, a MapLibre-style expression, or
undefinedto restore DOM-order stacking.
Returns void
- priority: number | MarkerPriorityExpression | undefined
MaptilersetRotation
Rotates the marker's inner shell element in degrees, via the CSS
scale(x, y) rotate(deg)transform on the inner wrapper — independent of MapLibre's own rotation on the outer container.Parameters
- rotation: number
Clockwise rotation in degrees.
Returns this
- rotation: number
setRotationAlignment
Sets the
rotationAlignmentproperty of the marker.Parameters
Optionalalignment: AlignmentSets the
rotationAlignmentproperty of the marker. defaults to 'auto'
Returns this
MaptilersetScale
Sets the 2-D scale of the marker as
[x, y].Parameters
- scaleVector: Vector2
Scale factors for the x and y axes.
Returns void
- scaleVector: Vector2
MaptilersetShadow
Sets the drop-shadow intensity.
Parameters
- shadow: MapTilerMarkerShadow | undefined
Shadow intensity preset, or
undefinedto reset to the default ("medium"). Use"none"to disable.
Returns void
- shadow: MapTilerMarkerShadow | undefined
MaptilersetShape
Sets the marker shape. Applies the new anchor offset (see applyShapeAnchorOffset).
Parameters
- shape: MapTilerMarkerShape | undefined
Marker shape key.
Returns void
- shape: MapTilerMarkerShape | undefined
MaptilersetSize
setSubpixelPositioning
MaptilersetTitle
Sets the
titleattribute on the marker's root element (native tooltip).Parameters
- title: string | undefined
Tooltip string, or
undefinedto remove the attribute.
Returns void
- title: string | undefined
MaptilersetTransitionForProperty
- setTransitionForProperty(
property: MarkerTransitionProperty,
transition: MarkerTransitionSpec | null,
): voidConfigures (or clears) the easing used the next time
propertychanges.Parameters
- property: MarkerTransitionProperty
Transitionable property to configure.
- transition: MarkerTransitionSpec | null
[duration, easing?, delay?]in milliseconds, ornullto make future changes snap immediately again.
Returns void
- property: MarkerTransitionProperty
MaptilersetUIState
Registers (or replaces) the property overrides applied while
nameis active. Applies immediately if that state is currently active.Parameters
- name: MapTilerMarkerUIStateName
UI state to configure.
- spec: UIStateSpec
Property overrides to apply while the state is active.
Returns void
- name: MapTilerMarkerUIStateName
toggleClassName
Add or remove the given CSS class on the marker element, depending on whether the element currently has that class.
Parameters
- className: string
Non-empty string with CSS class name to add/remove
Returns boolean
if the class was removed return false, if class was added, then return true
- className: string
MapLibre's
Markerextended with 2-D scale, named shapes, colour tokens, and batched DOM updates.