Перейти к основному содержимому

interface

AnimationOptions​

Common options for map animations. Used by methods such as setCenter, setZoom, etc.

Properties

animate?​

boolean

Determines if the transform should be animated.

duration?​

number

Duration of the animation in milliseconds.

easing?​

Easing function to be used with the animation.

ArrowOptions​

Arrow initialization options.

Properties

animate?​

boolean

Whether to animate the arrow. false by default.

color?​

string

Fill color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

coordinates​

number[][]|number[][][]

Arrow path or an array of arrow paths.

Simple case — a single arrow ( number[][] ): An array of points [firstPoint, secondPoint, ...] , where each point is a geographical coordinate [longitude, latitude] .

General case — multiple arrows ( number[][][] ): An array of paths [firstArrowPath, secondArrowPath, ...] , where each path is an array of points [firstPoint, secondPoint, ...] , and each point is a geographical coordinate [longitude, latitude] .

Each path defines a single arrow drawn along it with an arrow tip at the end. Multiple paths can be provided to draw several arrows within one Arrow object.

interactive?​

boolean

Whether the arrow responds to pointer events. true by default.

iterationCount?​

number

Number of animation iterations. Set to 1 for a single animation or a higher number for repeated animations. Note: This option takes effect only when animate is true .

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

roundingRadius?​

number

The rounding radius of arrow corners in pixels. Should correspond the width value.

strokeColor?​

string

Stroke color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

strokeWidth?​

number

Stroke width in pixels.

tipHeightMultiplier?​

number

The height multiplier of the arrow tip.

tipMovementAmplitude?​

number

The amplitude of the tip movement during animation in pixels.

tipWidthMultiplier?​

number

The width multiplier of the arrow tip.

userData?​

any

User specific data.

width?​

number

Line width in pixels.

zIndex?​

number

Draw order.

BinaryFeatureStateMap​

Binary representation of featureStateMap. Contains usual FeatureStateMap data packed by @2gis/json2pbf library

Example:

import { packJson } from '@2gis/json2pbf';

const featureStateMap = {
"70030076195691401": { "height": 300 },
"70030076130722099": { "height": 200 },
}

const packed = packJson(featureStateMap);

ChangeLanguageEvent​

Contains current map language

Properties

lang​

string

Language short name.

CircleMarkerOptions​

CircleMarker initialization options.

Properties

color?​

string

Fill color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

coordinates​

number[]

Geographical coordinates of the circleMarker center and optional height in meters : [longitude, latitude, height?] .

diameter?​

number

CircleMarker diameter in pixels.

interactive?​

boolean

Allows the circleMarker to emit events (like mouseover ). true by default.

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

stroke2Color?​

string

The second stroke color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

[DEPRECATED] Will be removed in the next major release, use additional CircleMarker to draw an extra stroke.

stroke2Width?​

number

The second stroke width in pixels.

[DEPRECATED] Will be removed in the next major release, use additional CircleMarker to draw an extra stroke.

strokeColor?​

string

Stroke color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

strokeWidth?​

number

Stroke width in pixels.

userData?​

any

User defined data

zIndex?​

number

Draw order.

CircleOptions​

Circle initialization options.

Properties

color?​

string

Fill color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

coordinates​

number[]

Geographical coordinates of the circle center: [longitude, latitude] .

interactive?​

boolean

Allows the circle to emit events (like mouseover ). true by default.

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

radius​

number

Circle radius in meters.

strokeColor?​

string

Stroke color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

strokeWidth?​

number

Stroke width in pixels.

userData?​

any

User specific data.

zIndex?​

number

Draw order.

ControlOptions​

Control initialization options.

Properties

position?​

Position of the control.

By default it's topRight .

DashedLineStyleLayer​

Dashed line style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"dashedLine"

Layer type.

DefaultEventTargetData​

The default targetData of a pointer event.

Properties

floorId?​

string

ID of the particular floor. It's specified when the target object is a part of a floor plan object (e.g. the room in a building).

id​

string

ID of the target object.

layerId?​

string

Style layer ID of the target object.

poiIcon?​

POI icon data. It's specified when the target object is a POI with an icon.

type​

"default"

Type the default event data.

DestroyMapEvent​

Destroy event.

DynamicObjectEventTable​

The list of events that can be emitted by markers.

Properties

click​

DynamicObjectPointerEvent<T>

Emitted when the marker is clicked.

mousedown​

DynamicObjectPointerEvent<T>

Emitted when the user presses a mouse button over the marker.

mousemove​

DynamicObjectPointerEvent<T>

Emitted when the user moves the pointer over the marker.

mouseout​

DynamicObjectPointerEvent<T>

Emitted when the user moves the mouse away from the marker.

mouseover​

DynamicObjectPointerEvent<T>

Emitted when the user hovers over the marker.

mouseup​

DynamicObjectPointerEvent<T>

Emitted when the user releases the mouse button over the marker.

touchend​

DynamicObjectPointerEvent<T>

Emitted when the user lifts the finger off the marker.

touchmove​

DynamicObjectPointerEvent<T>

Emitted when the user moves the finger across the marker.

touchstart​

DynamicObjectPointerEvent<T>

Emitted when the user taps on the marker.

DynamicObjectPointerEvent​

The event type for pointer-related map object events.

Properties

lngLat​

number[]

Geographical coordinates of the event.

originalEvent​

TouchEvent<>|MouseEvent<>

The original DOM event.

point​

number[]

Screen coordinates of the event.

targetData​

T

The target map object of a pointer event.

EventTarget​

The target of a pointer event.

Properties

id​

string

ID of the target object.

FeatureState​

FeatureState attributes.

Properties

[key: string]​

number|string|boolean|null

FeatureStateMap​

FeatureStateMap source attributes.

Example:

const featureStateMap = {
"70030076195691401": { "height": 300 },
"70030076130722099": { "height": 200 },
}
Properties

[key: string]​

FitBoundsOptions​

Options for fitBounds method.

Properties

animation?​

Animation options.

considerRotation?​

boolean

If true the fitBounds will consider the map rotation

maxZoom?​

number

The limit for the maximum zoom.

padding?​

Partial<Padding>

The amount of padding in pixels to add to the given bounds.

skipMapPadding?​

boolean

If true fitBounds ignores the padding property in the map options

FloorControlOptions​

Floor control initialization options.

Properties

position?​

Position of the control.

By default it's topRight .

FloorLevel​

Contains a floor level data.

Properties

floorLevelIndex​

number

A floor level index

floorLevelName​

string

A floor level name

FloorLevelChangeEvent​

Contains a current floor level data.

Properties

floorLevelIndex​

number

A current level index of a floor plan.

floorLevelName​

string

A current level name of a floor plan.

floorMode​

"floor"|"metro"

Floor plan mode.

floorPlanId​

string

An id of a floor plan.

FloorPlanHideEvent​

Contains a disappeared floor plan data.

Properties

floorPlanId​

string

An id of a disappeared floor plan.

FloorPlanShowEvent​

Contains an appeared floor plan data.

Properties

currentFloorLevelIndex​

number

An index of a current displayed floor level.

floorLevels​

FloorLevel[]

All available floor plan levels.

floorMode​

"floor"|"metro"

Floor plan mode.

floorPlanId​

string

An id of an appeared floor plan.

GeoJsonEventTargetData​

The GeoJson target data of a pointer event.

Properties

feature?​

Feature<Geometry, GeoJsonProperties>

GeoJson feature.

id?​

string|number

ID of the feature.

layerId?​

string

Style layer ID of the feature.

source​

GeoJsonSource<>

GeoJson source.

type​

"geojson"

Type the geojson event data.

GeoJsonSourceOptions​

GeoJson data source initialization options.

Properties

attributes?​

Data source attributes.

data​

Feature<Geometry, GeoJsonProperties>|FeatureCollection<Geometry, GeoJsonProperties>

GeoJSON collection of feature objects or feature object.

dimensions?​

number

Number of coordinates per vertex in the input array (2 by default)

idScope?​

string

Put IDs of source features to separate ID-scope. If idScope isn't specified, all IDs will be added into the default scope. Objects that have the same ID inside ID-scope will be processed by map as one object. For example, these objects will be selected simultaneously.

Scope of the identifiers is used for objects selection, see method map.setSelectedObjects.

maxZoom?​

number

The maximum zoom value for which geojson tiles will be generated.

modelsPath?​

string

Path to the models. Used when model's url in the source is a relative path

promoteId?​

string

Name of the object attribute to use as ID. If specified, ID will be presented in GeoJsonEventTargetData.

tolerance?​

number

Simplification tolerance (higher means simpler)

GeoJsonViewportSourceOptions​

GeoJson viewport data source initialization options.

Properties

attributes?​

Data source attributes.

data​

(bbox: number[]) => string

GeoJSON source data bbox function.

dimensions?​

number

Number of coordinates per vertex in the input array (2 by default)

idScope?​

string

Put IDs of source features to separate ID-scope. If idScope isn't specified, all IDs will be added into the default scope. Objects that have the same ID inside ID-scope will be processed by map as one object. For example, these objects will be selected simultaneously.

Scope of the identifiers is used for objects selection, see method map.setSelectedObjects.

maxZoom?​

number

The maximum zoom value for which geojson tiles will be generated.

modelsPath?​

string

Path to the models. Used when model's url in the source is a relative path

promoteId?​

string

Name of the object attribute to use as ID. If specified, ID will be presented in GeoJsonEventTargetData.

tolerance?​

number

Simplification tolerance (higher means simpler)

viewportPadding?​

number

Viewport padding in pixels to increase the viewport-based area to get data.

GraphicsPreset​

Graphics preset.

Properties

fogOff​

undefined|boolean

globeOff​

undefined|boolean

immersiveRoadsOff​

undefined|boolean

modelsOff​

undefined|boolean

reliefOff​

undefined|boolean

shadowsOff​

undefined|boolean

skyOff​

undefined|boolean

GroupStyleLayer​

Group layer.

Properties

id​

string

Layer identifier.

layers​

Array of layers that the group contains. The array must not contain other layers with the group type, because nested groups are not supported.

orderBy?​

Expression[]

Defines the drawing order of objects on the map. Objects are grouped by the first expression. Within the resulting groups, they are regrouped by the next one, and so on.

type​

"group"

Layer type.

HeatmapStyleLayer​

Heatmap style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"heatmap"

Layer type.

HtmlMarkerOptions​

HtmlMarker initialization options.

Properties

anchor?​

number[]

The position in pixels of the "tip" of the HTML marker relative to its top-left corner.

coordinates​

number[]

An array of numbers [longitude, latitude, height?] , where:

  • 'longitude' and 'latitude' are the geographical coordinates of the top-left corner of the HTML marker. Taking into account the 'anchor' option.
  • 'height' is an optional number in meters by which the marker will be raised/lowered (depending on the sign of the value) relative to the map surface. 0 by default.

disableRounding?​

boolean

If true, the marker coordinates will not be rounded. By default it's false .

html​

string|HTMLElement<>

HTML content of the HTML marker.

interactive?​

boolean

HTML marker can be pointer-event target if this option is set to true (pointer-events: auto), otherwise it can't (pointer-events: none).

labeling?​

HTML marker labeling options.

  • type: 'none' — the marker is always visible and not involved in labeling
  • type: 'full' — the marker can hide other labeling elements or can be hidden
  • type: 'invincible' — the marker is always visible and can hide other labeling elements
  • type: 'pinnedToPoi' — the marker can hide other labeling elements or can be hidden. It's labeling behavior is taken from the linked POI id.
  • width — the width of the labeling box
  • height — the height of the labeling box
  • offset — the offset in pixels of the labeling box. Positive values indicate right and down, while negative values indicate left and up.
  • poiId — the linked POI id

maxZoom?​

number

Maximum display styleZoom of the HTML marker.

minZoom?​

number

Minimum display styleZoom of the HTML marker.

preventMapInteractions?​

boolean

Capture events if set. Otherwise events will passed to the map. By default it's true .

userData?​

any

User specific data.

zIndex?​

number

Draw order.

LabelImage​

Source image for text label background.

Properties

padding?​

[number, number, number, number]

Sets the space in pixels between the label text box and the edge of the stretched image for all four sides [top, right, bottom, left], like in CSS. [0, 0, 0, 0] by default.

pixelRatio?​

number

The ratio of logical pixels in the image to physical pixels on the screen.

size​

[number, number]

[width, height] — image size in logical pixels

stretchX?​

[number, number][]

Defines the parts of the image that can be stretched horizontally.

stretchY?​

[number, number][]

Defines the parts of the image that can be stretched vertically.

url​

string

Source image URL.

LabelLineStyleLayer​

Label line style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"labelLine"

Layer type.

LabelOptions​

Label initialization options.

Properties

anchor?​

number[]

The offset distance of text box from its relativeAnchor . Positive values indicate left and up, while negative values indicate right and down.

[DEPRECATED] Will be removed in the next major release, use the offset option instead.

color?​

string|Expression

Text color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

coordinates​

number[]

An array of numbers [longitude, latitude, height?] , where:

  • 'longitude' and 'latitude' are the geographical coordinates of the top-left corner of the label. Taking into account the relativeAnchor option.
  • 'height' is an optional number in meters by which the label will be raised/lowered (depending on the sign of the value) relative to the map surface. 0 by default.

fontSize?​

number

Text size.

haloColor?​

string|Expression

Background color of letters (when haloRadius is specified). The same format as for color .

haloRadius?​

number

Use haloRadius to add background behind each letter.

image?​

Background image for the label.

interactive?​

boolean

Allows the label to emit events (like mouseover ). false by default.

labeling?​

Labeling options

  • none — the label is not involved in the labeling process in any way
  • pointLabelsOnly — the label overlaps or can be overlapped by labels having this labeling option specified as type

letterSpacing?​

number

Space between each letter.

lineHeight?​

number

For multiline label lineHeight specify how far lines between each other.

maxZoom?​

number

Maximum display styleZoom of the label.

minZoom?​

number

Minimum display styleZoom of the label.

offset?​

number[]

The offset distance of text box from its relativeAnchor . Positive values indicate right and down, while negative values indicate left and up.

relativeAnchor?​

number[]

Coordinates (from 0 to 1 in each dimension) of the text box "tip" relative to its top left corner, for example: [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. The label will be placed so that this point is at geographical coordinates respects the absolute offset .

text​

string

Label's text.

userData?​

any

User specific data.

zIndex?​

number

Draw order.

LineExtrusionStyleLayer​

Line extrusion style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"lineExtrusion"

Layer type.

LineStyleLayer​

Line style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"line"

Layer type.

LngLatBounds​

Geographical bounds.

Properties

northEast​

number[]

The north-east point of the bounds [longitude, latitude] .

southWest​

number[]

The south-west point of the bounds [longitude, latitude] .

MapEvent​

The general event type for map events.

Properties

isUser​

boolean

True if event was emitted by user's interaction.

MapEventTable​

The list of events that can be emitted by the map.

Properties

center​

Emitted repeatedly during any change in the map's center.

centerend​

Emitted after any change in the map's center.

centerstart​

Emitted before any change in the map's center.

changeLanguage​

Emitted after the map language is changed.

click​

Emitted when the map is clicked.

contextmenu​

Emitted when the map is clicked by right button.

destroy​

Emitted after the map is destroyed.

floorlevelchange​

Emitted after the floor plan level is changed.

floorplanhide​

Emitted after the floor plan is disappeared from the map.

floorplanshow​

Emitted after the floor plan is shown on the map.

idle​

Emitted when the map becomes idle after some interaction (drag, zoom etc). Idle means that the map is not interacting, all tiles are drawn and labeling is finished. This event doesn't take into account any asset loading (for example, marker icons).

mousedown​

Emitted when the user presses a mouse button over the map.

mousemove​

Emitted when the user moves the pointer over the map.

mouseout​

Emitted when the user moves the mouse away from the map item.

mouseover​

Emitted when the user hovers over a map item.

mouseup​

Emitted when the user releases the mouse button over the map.

move​

Emitted repeatedly during any transition from one map view to another, caused by moving, zooming, rotating, or pitching.

moveend​

Emitted after any transition from one map view to another, caused by moving, zooming, rotating, or pitching.

movestart​

Emitted before any transition from one map view to another, caused by moving, zooming, rotating, or pitching.

pitch​

Emitted repeatedly during any change in the map's pitch.

pitchend​

Emitted after any change in the map's pitch.

pitchstart​

Emitted before any change in the map's pitch.

resize​

Emitted after any change in the map's size.

rotation​

Emitted repeatedly during any change in the map's pitch.

rotationend​

Emitted after any change in the map's pitch.

rotationstart​

Emitted before any change in the map's pitch.

styleload​

Emitted after the map style is loaded.

styleloaderror​

Emitted after the map style fails to load.

touchend​

Emitted when the user lifts the finger off the map.

touchmove​

Emitted when the user moves the finger across the map.

touchstart​

Emitted when the user taps on the map.

traffichide​

Emitted after the traffic layer hid from the map.

trafficscore​

Emitted after update current traffic score.

trafficshow​

Emitted before the traffic layer showed on the map.

zoom​

Emitted repeatedly during any change in zoom level.

zoomend​

Emitted after any change in zoom level.

zoomstart​

Emitted before any change in zoom level.

MapOptions​

Map initialization options.

Properties

autoHideOSMCopyright?​

boolean

Enables OSM copyright auto hide after 5 sec

[DEPRECATED] This option is no longer supported and will be removed in the next major release.

center?​

number[]

Map center in geographical coordinates ( [longitude, latitude] ).

controlsLayoutPadding?​

Partial<Padding>

Sets padding for controls layout

copyright?​

Where to add copyright control during the map initialization. By default it's "bottomRight" .

defaultBackgroundColor?​

string

Sets default background color, while style is loading

disableAntiAliasing?​

boolean

Disables fullscreen AntiAliasing when map is idle. True by default.

disableDragging?​

boolean

Prevents the map from dragging.

disableHidingPois?​

boolean

Disables hiding POIs behind objects such as buildings, 3D models, etc. False by default.

disablePitchByUserInteraction?​

boolean

Prevents users from pitching the map.

disableRenderingCache?​

boolean

Disable render caching.

disableRotationByUserInteraction?​

boolean

Prevents users from rotating the map.

disableZoomOnScroll?​

boolean

Disables map zoom on scrolling over the map container.

enableTrackResize?​

boolean

Tracks changes of the map container size and automatically updates the size of the map.

enableTwoFingerDragging?​

boolean

Enables map dragging using two touches. If set to true, three touches will pitch map. Single touch drag will be enabled also, use disableDragging: true to disable it.

floorControl?​

Whether a floor control should be added during the map initialization. By default it's false . Set to true to add the floor control at "topRight" position.

forceSyncIdentify?​

boolean

Forces map to use syncronous objects picking (identification). This can cause performance issues on some devices, but can fix artifacts when sharing gl-context between different libraries (e.g. deck.gl).

graphicsPreset?​

Sets active graphics preset.

If set map will work in graphics preset mode:

  • map takes into an account configured graphics presets in style
  • map.getGraphicsPreset() method becomes available

Otherwise, map will ignore graphics presets from style object.

Available values:

  • 'light' - light graphics preset
  • 'normal' - normal graphics preset
  • 'immersive' - immersive graphics preset
  • 'auto' - EXPERIMENTAL graphics preset will be set depending on benchmark result

iconIdentifyOpacity?​

number

When rendering icons to the identification scene, pixels with opacity below this value will be ignored. Default value is 0.3.

keepCenterWhileUserZoomRotate?​

boolean

Prevents center changing while user is zooming or rotating the map by touch.

key?​

string

The key that allows usage of the API.

lang?​

string

The desired map language. short language code 'en', 'ru', ...etc

loopWorld?​

boolean

Loop the map when rendering at large scales or near the anti-meridian

lowZoomMaxPitch?​

number

Maximum map pitch in degrees for low zoom (zoom < 16.5).

maxBounds?​

The map will be constrained to the given bounds, if set.

maxPitch?​

number

Maximum map pitch in degrees.

maxZoom?​

number

Maximum map styleZoom.

minPitch?​

number

Minimum map pitch in degrees.

minZoom?​

number

Minimum map styleZoom.

padding?​

Dimensions in pixels applied on each side of the viewport for shifting the vanishing point. the padding on each side has a clamp to a positive value no larger than the map canvas size for either side

pitch?​

number

Map pitch in degrees.

preserveDrawingBuffer?​

boolean

Sets preserveDrawingBuffer option to WebGLRenderingContext.

rotation?​

number

Map rotation in degrees.

scaleControl?​

Whether a scale control should be added during the map initialization. By default it's false . Set to true to add the scale control at "bottomLeft" position.

style?​

string

The map style ID, that you can get at https://styles.2gis.com

styleOptions?​

Partial<StyleOptions>

Map style options. Containts path to style assets - icons, fonts, models etc. Warning: If the options are incompatible, a broken style might be applied. Map styles are constantly evolving in order to display new cartographic data. By storing the style on your own side, you assume the responsibility to update it periodically and take care of its relevance. It is recommended to use map.setStyleById to update styles during runtime.

styleState?​

Map style global variables

styleZoom?​

number

Map style zoom. Use this option if you want to set the same zoom that is used in the style settings. The styleZoom and zoom options set the same map scale but in different projections. If both options are set, the styleZoom has a higher priority than the zoom option.

touchRotationThreshold?​

number

Map rotation threshold with multitouch in degrees. 10 by default.

trafficControl?​

Whether a traffic control should be added during the map initialization. By default it's false . Set to true to add the traffic control at "topRight" position.

trafficOn?​

boolean

Whether traffic layer is enabled on the map.

useRtlTextPlugin?​

"always-on"|"always-off"|"depends-on-language"

Enables map to download additional plugin for RTL-text rendering. Values are:

  • 'always-on' - plugin will be downloaded at map initialization.
  • 'always-off - plugin will not be downloaded.
  • 'depends-on-language' - plugin will be downloaded only if "ar" language is selected.

Default value is 'depends-on-language'. If the language of the map is not rtl (eg. 'en') and tiles contain rtl labels, you should use 'always-on' to render rtl label properly.

webglVersion?​

Sets the map WebGL version. It can be helpful if you use CustomLayer with other WebGL libraries.

zoom?​

number

Map zoom.

zoomControl?​

Whether a zoom control should be added during the map initialization. By default it's "topRight" . Set to false to not add the control.

MapPointerEvent​

The event type for pointer-related map events.

Properties

lngLat​

number[]

Geographical coordinates of the event.

originalEvent​

TouchEvent<>|MouseEvent<>

The original DOM event.

point​

number[]

Screen coordinates of the event.

target?​

Target (geographical object) of the event.

targetData?​

The source target data of a pointer event.

MapSupportOptions​

Options for Map.isSupported method.

Properties

failIfMajorPerformanceCaveat​

boolean

Causes isSupported method to return false if the performance of MapGL would be dramatically worse than expected (i.e. a software renderer is would be used)

MarkerIconOptions​

Options for marker setIcon and setHoverIcon methods.

Properties

anchor?​

number[]

The position in pixels of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified.

icon​

string

Marker icon URL.

opacity?​

number|Expression

Marker icon opacity.

size?​

number[]

Marker icon size [width, height] in pixels.

MarkerLabelOptions​

Options for the label of marker.

Properties

anchor?​

number[]

The offset distance of text box from its relativeAnchor . Positive values indicate left and up, while negative values indicate right and down.

[DEPRECATED] Will be removed in the next major release, use the offset option instead.

color?​

string|Expression

Text color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

font?​

string

Font family.

fontSize?​

number

Text size.

haloColor?​

string|Expression

Background color of letters (when haloRadius is specified). The same format as for color .

haloRadius?​

number

Use haloRadius to add background behind each letter.

image?​

Background image for the label.

letterSpacing?​

number

Space between each letter.

lineHeight?​

number

For multiline label lineHeight specify how far lines between each other.

maxZoom?​

number

Maximum display styleZoom of the label. Note that the label's zoom-dependent visibility is constrained by the marker's minZoom and maxZoom options, if specified.

minZoom?​

number

Minimum display styleZoom of the label. Note that the label's zoom-dependent visibility is constrained by the marker's minZoom and maxZoom options, if specified.

offset?​

number[]

The offset distance of text box from its relativeAnchor . Positive values indicate right and down, while negative values indicate left and up.

relativeAnchor?​

number[]

Coordinates (from 0 to 1 in each dimension) of the text box "tip" relative to its top left corner, for example: [0, 0] value is the top left corner, [0.5, 0.5] — center point, and [1, 1] is the bottom right corner of the box. The label will be placed so that this point is at geographical coordinates respects the absolute offset .

text​

string

Label's text.

zIndex?​

number

Draw order.

MarkerOptions​

Marker initialization options.

Properties

anchor?​

number[]

The position in pixels of the "tip" of the icon (relative to its top left corner). The icon will be aligned so that this point is at the marker's geographical location. Centered by default if size is specified.

coordinates​

number[]

Geographical coordinates of marker center [longitude, latitude, altitude?] , where altitude is an optional component in meters.

hoverAnchor?​

number[]

Icon anchor in hovered state.

hoverIcon?​

string

Marker icon URL in hovered state.

hoverOpacity?​

number|Expression

Marker icon opacity in hovered state.

hoverSize?​

number[]

Marker icon size [width, height] in pixels in hovered state.

icon?​

string

Marker icon URL.

interactive?​

boolean

Allows the marker to emit events (like mouseover ). true by default.

label?​

Initialization options of the marker's label.

maxZoom?​

number

Maximum display styleZoom of the marker.

minZoom?​

number

Minimum display styleZoom of the marker.

opacity?​

number|Expression

Marker icon opacity.

rotation?​

number

Icon clockwise rotation in the screen plane in degrees.

size?​

number[]

Marker icon size [width, height] in pixels.

userData?​

any

User specific data.

zIndex?​

number

Draw order.

MetricPointStyleLayer​

Metric point style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"metricPoint"

Layer type.

ModelStyleLayer​

Model style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"model"

Layer type.

Padding​

Padding in pixels on different sides of the container.

Properties

bottom​

number

Bottom padding in pixels.

left​

number

Left padding in pixels.

right​

number

Right padding in pixels.

top​

number

Top padding in pixels.

ParticleAffectorOptionsBase​

Fields common to every affector config.

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

ParticleAnchorObject​

Map object that can be used as an anchor for a particle system.

Only public methods are used:

getCoordinates() returns [lng, lat] or [lng, lat, altitude(m)] ;

getRotation() returns the rotation angle (a number, yaw in degrees) or Euler angles [x, y, z] in degrees. Optional: without it rotation is ignored.

GltfModel and Marker satisfy this contract.

ParticleAppearance​

Appearance envelopes applied to every particle over its normalized lifetime.

This is where a particle stops being a physics body and starts being a visual: the values here are written directly into the render channels (size, rotation, color) instead of affecting velocity. Affectors, on the other hand, act on the motion — that split is why this list is not a part of the affector set.

Every channel is optional: an omitted one leaves the spawn value in place. A constant instead of an array of keys means a value that doesn't change over the lifetime.

t = age / maxAge , so the curves are independent of rate , maxParticles

and of how long the system lives — the same config scales to any lifetime.

@example [object Object]

Properties

angle?​

ParticleCurve<number>

Sprite rotation over the lifetime, in radians. Sets the absolute angle, not the angular velocity — a spin is just a linear curve from 0 to 2 * PI * n .

0 at every t (no rotation) by default.

color?​

Color over the lifetime (RGBA components or a CSS string). Overwrites the spawn color completely.

scale?​

ParticleCurve<number>

Size multiplier over the lifetime, applied to the per-particle initial size ( ParticleSpawnOptions.size ) — so the random spread of sizes survives the curve and particles don't all become identical.

1 at every t (no change) by default.

ParticleAppearancePatch​

Appearance patch: null removes a channel, undefined leaves it as is.

ParticleAppearance describes what exists; a patch describes what to change. Without null the two intents look identical: a dynamically assembled patch with { color: undefined } means both "leave it alone" and "erase it" — and the second one is almost never intended.

A removed channel stops being applied from the next frame. Alive particles keep the last value it produced until they die — only the particles spawned afterwards get the spawn values back.

The same rule applies to texture : null goes back to procedural rendering,

undefined is untouched.

Properties

angle?​

null|ParticleCurve<number>

null removes the envelope, a value replaces it.

color?​

null removes the envelope, a value replaces it.

scale?​

null|ParticleCurve<number>

null removes the envelope, a value replaces it.

ParticleBoxShapeOptions​

Particles are born uniformly inside a box, in meters.

Properties

size​

readonly [number, number, number]

Box size [x, y, z] in meters. The box is axis-aligned with the map axes at zero anchor rotation.

type​

"box"

Shape discriminant.

ParticleBuoyancyAffectorOptions​

Buoyancy: pushes particles up.

value is either a constant acceleration or a curve over the particle lifetime — a number or an array of keys, told apart by the shape of the value. Combine it with gravity to get net lift ( gravity: -9.8 + buoyancy: 11 gives a slow rise).

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

value?​

ParticleCurve<number>

Upward acceleration in m/s^2: either a constant or a curve over the normalized lifetime. 9.81 by default.

A broken or empty key set turns the lift off ( 0 ) rather than falling back to Earth's compensation: "no curve given" here means "no force given".

@example [object Object] @example [object Object]

ParticleCircleShapeOptions​

Particles are born on a circle of radius , in meters.

Properties

radius​

number

Circle radius, in meters.

type​

"circle"

Shape discriminant.

ParticleCurveKey​

Curve key: a value at a normalized particle lifetime.

The value type depends on the curve: a number for scalar curves, a

ParticleColor for color curves.

Properties

easing?​

How the curve leaves this key. 'linear' by default.

t​

number

Normalized lifetime: 0 is birth, 1 is death.

value​

T

Value at time t .

ParticleDragAffectorOptions​

Medium resistance: slows particles down.

Properties

coefficient?​

number

Resistance coefficient, dimensionless, never negative. 1 by default.

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

ParticleEmitterOptions​

Emitter configuration — a birth volume with its own particle pool.

A system may hold several emitters: they share the anchor and the affector set (one wind for fire and smoke) and differ in everything else — shape, spawn ranges, appearance, texture and pool size.

The emitter defines only where and how particles are born. Its position is not a part of the config: it comes from the anchor ( ParticleSystemOptions.anchor ) plus ParticleEmitterOptions.offset .

@example [object Object]

Properties

appearance?​

Size, colour and spin angle envelopes over the particle's lifetime.

launch?​

Direction, cone, speed and inherited motion of the jet.

maxParticles​

number

Maximum number of simultaneously alive particles — the pool size.

Required: this is the fill-rate budget, and the right value depends on the device. The engine falls back to 10 000, which is already a lot for a mobile WebView.

The pool and the GPU buffers are allocated for it, so the value is fixed for the whole lifetime of the emitter: changing it means creating a new emitter, which drops the alive particles.

offset?​

readonly [number, number, number]

Emitter offset from the system anchor, [x, y, z] in meters.

For an object anchor the offset is rotated together with the object and the shape, so it stays glued to the model. The shift is applied at spawn only: changing it does not drag the already born particles. [0, 0, 0] by default.

rate​

number

Spawn rate, in particles per second.

Required: a system created without it silently spawns nothing, and that is almost always a forgotten field rather than a deliberate choice. The engine default is 0 , so the value can be turned up at runtime.

refraction?​

Screen-space refraction of the scene for the particles of this emitter.

renderMode?​

How each particle is drawn. 'billboard' by default.

shape?​

Where new particles appear. Defaults to a single point.

softness?​

number

Edge softness of a sprite, 0 (sharp) to 1 (maximally blurred). Implemented as a Gaussian falloff plus noise, so intermediate values change the profile continuously. 0 by default.

spawn?​

Per-particle random ranges applied at spawn.

lifetime , size and color are required there; mass falls back to its default. Omitting the whole field is allowed — the engine then uses one second and one metre, which produces a visible but obviously generic particle rather than an invisible one.

texture?​

Texture atlas: a grid of cols x rows frames, each particle gets a random one. Without a texture particles are rendered procedurally: a soft disc for

'billboard' , a streak for 'stretch' .

ParticleEmitterPatch​

Partial emitter config for ParticleSystem.patchEmitter .

Omitted fields keep their current values. The merge rules are uniform: top-level objects ( spawn , launch , appearance ) are merged field by field, arrays and scalars are replaced. That is why spreading the current resolved config is always a correct way to change a single value.

maxParticles is deliberately absent: the pool capacity is structural — the GPU buffers are allocated for it. Changing it means replacing the emitter:

removeEmitter + addEmitter , which drops the alive particles.

Properties

appearance?​

Envelopes, merged per channel: { scale } keeps the color and the angle,

{ color: null } removes the color envelope.

launch?​

Partial launch settings: direction , spread , speed , inheritVelocity .

offset?​

readonly [number, number, number]

Emitter offset from the anchor, in meters.

rate?​

number

Spawn rate, in particles per second.

refraction?​

Refraction parameters, null to go back to plain blending, undefined

to keep the current value.

renderMode?​

Render mode. Unlike the other fields it is not applied in place: the GPU state is rebuilt on the next frame.

shape?​

Where new particles appear. A different shape resets alive particles.

softness?​

number

Edge softness of a sprite, 0 (sharp) to 1 (maximally blurred).

spawn?​

Partial ranges; omitted fields keep their current values.

texture?​

A new atlas, or null to fall back to procedural rendering.

ParticleGravityAffectorOptions​

Constant vertical acceleration.

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

value​

number

Acceleration in m/s^2. Negative pulls particles down; Earth's gravity is

-9.8 ; -9.81 by default.

ParticleLaunchOptions​

How new particles leave the emitter: direction, cone, speed and inherited motion.

Every term of the initial velocity lives here: v = direction * speed + inheritVelocity * v_anchor . Splitting them across objects keeps one formula in two places.

Lives next to ParticleSpawnOptions rather than inside it, because the direction is a property of the jet, not of a single particle: it is one vector for the whole emitter.

Properties

direction?​

readonly [number, number, number]

Unit vector of the jet, normalized on input. A zero vector falls back to

[0, 0, 1] (up). [0, 0, 1] by default.

Given in the emitter's local space and rotated together with the anchor, exactly like the birth position: an exhaust of a model turned by 90° flies along the model's own axis, not along the world vertical.

Multiplied by speed , so with speed: 0 (the default) it has no effect at all.

inheritVelocity?​

number

Multiplier of the emitter's own velocity added to a newly spawned particle, so particles can trail behind, ride along or shoot ahead of a moving emitter.

0 — particles fly in world axes (smoke from a chimney);

0..1 — partially carried along (dust under wheels);

1 — particles are glued to the emitter (steam from an exhaust);

> 1 — particles overtake the emitter (a jet, splashes);

< 0 — particles fly backwards relative to the emitter (wake).

Any finite value is valid: this is a plain multiplier, not a fraction.

The full translation of the emitter is inherited: the anchor motion plus the change of the emitter's own offset . Rotation is not inherited — a particle born in place ( speed: 0 ) does not orbit a turning object.

For the 'camera' anchor the inherited velocity is the camera's own translation, so weather effects usually keep the default: otherwise the whole snow volume gets dragged along with the view. 0 by default.

speed?​

readonly [number, number]

Initial speed [min, max] in m/s, along direction . [0, 0] by default: a particle is born in place and is carried away by forces.

A range: each particle gets a random value inside it. Zero here is meaningful — an effect may live entirely on wind, gravity or

inheritVelocity .

spread?​

number

Cone half-angle around direction , in degrees, clamped to 0..180 .

0 makes all particles fly strictly along the direction, 180 covers the whole sphere. 0 by default.

ParticlePointShapeOptions​

All particles are born at one point — the emitter position.

Properties

type​

"point"

Shape discriminant.

ParticleRefraction​

Screen-space refraction parameters of an emitter.

Properties

ior?​

number

Index of refraction, like for real materials: 1.33 (water) by default, glass is about 1.5 . 1.0 disables bending completely.

strength?​

number

How strongly the particle distorts the image behind it. 0 means no distortion; the default 0.012 .

ParticleSpawnOptions​

Parameters of newly spawned particles.

Ranges are [min, max] : each particle gets a random value inside it. All sizes are in meters and speeds in meters per second, regardless of the anchor mode.

lifetime , size and color are required. A forgotten lifetime or size

produces a particle that dies in the frame it was born or is drawn at zero size — neither is visible on the map, and there is no meaningful default for them: the right values depend entirely on the effect. color is required for the same reason: the engine default is opaque white, which on a map reads as a rendering glitch rather than as an effect.

mass stays optional because its default is meaningful rather than "switched off": mass: 1 is the neutral value all force formulas are tuned for.

The initial speed is not here — it lives in

ParticleLaunchOptions.speed , together with the direction it is applied along.

Properties

color​

Initial color: RGBA components in the [0, 1] range, or a CSS string.

Required — see the note above. An alpha of 0 makes particles invisible, which is a valid way to hide an emitter, but it has to be written explicitly.

lifetime​

readonly [number, number]

Lifetime [min, max] in seconds.

Required — see the note above.

mass?​

readonly [number, number]

Particle mass [min, max] . [1, 1] by default; the lower bound is clamped so mass can never reach zero.

Mass affects the reaction to forces: drag , turbulence and wind are inversely proportional to it, so lighter particles are carried away faster. Keep it close to 1 unless the effect needs a difference between emitters: a tiny mass freezes a particle under drag and snaps it to the wind speed.

size​

readonly [number, number]

Initial size [min, max] , in meters.

Required — see the note above.

ParticleSpawnPatch​

Partial spawn config for ParticleSystem.patchEmitter .

Every field is optional: omitted ones keep their current values. This is the patch mirror of ParticleSpawnOptions , where lifetime , size and

color are required — so a patch never resends them.

Properties

color?​

Initial color: RGBA components in the [0, 1] range, or a CSS string.

lifetime?​

readonly [number, number]

Lifetime [min, max] in seconds.

mass?​

readonly [number, number]

Particle mass [min, max] ; the lower bound is clamped so it never reaches zero.

size?​

readonly [number, number]

Initial size [min, max] , in meters.

ParticleSphereShapeOptions​

Particles are born inside a sphere of radius , in meters.

Properties

radius​

number

Sphere radius, in meters.

type​

"sphere"

Shape discriminant.

ParticleSystemEventTable​

Events emitted by ParticleSystem .

Properties

destroy​

void

Emitted after the system is destroyed (resources released).

reset​

void

Emitted when ParticleSystem.reset drops all alive particles.

start​

void

Emitted when the system resumes spawning. A new system is already spawning, so the first ParticleSystem.start emits nothing.

stop​

void

Emitted when spawning is switched off: no new particles, alive ones live out their lifetime and fade away.

ParticleSystemOptions​

Particle system options.

anchor is required — it is the coordinate space of the system and the reference point everything else is measured from. emitters is required too, though it may be empty: a system without emitters is valid and simply draws nothing.

const snow = new mapgl.ParticleSystem(map, {
anchor: 'camera',
emitters: {
flakes: {
renderMode: 'billboard',
rate: 5000,
maxParticles: 40000,
shape: { type: 'box', size: [400, 400, 120] },
launch: { direction: [0, 0, -1], spread: 40, speed: [4, 8] },
spawn: {
lifetime: [4, 8],
size: [0.4, 0.6],
color: [1, 1, 1, 0.85],
},
},
},
affectors: {
gravity: { type: 'gravity', value: -9.8 },
},
});

All spatial values are in meters and all speeds in meters per second, independent of the anchor mode.

Properties

affectors?​

Record<string, ParticleAffector>

Affectors — forces acting on the particles of every emitter.

A map of name -> config : the key is the unique name of the affector inside the system and is not a part of the config itself.

Affectors are applied in the order they are defined; the order of object keys is preserved. This matters for force pairs (gravity and drag do not commute), so keep the physics order in mind.

The system copies the configs on input: later mutation of the passed object has no effect.

@example [object Object]

anchor​

What the emitters are bound to:

'camera' — the system follows the camera (rain, snow);

[lng, lat, altitude?] — a fixed geographical position (smoke, fountain);

  • a map object with getCoordinates() — particles follow the object.

No default on purpose: see ParticleAnchor .

emitters​

Record<string, ParticleEmitterOptions>

Emitters of the system, a map of name -> config .

The key is the unique name of the emitter inside the system and is not a part of the config itself. Emitters are drawn in the order they are defined, which matters for transparent particles.

The anchor and the affector set are shared: they describe the world point and the forces, which several emitters of one system usually share (fire and smoke move in the same wind). Everything else — shape, spawn ranges, appearance, texture, refraction and the pool — is per emitter, so it gets a separate pool and separate GPU buffers.

userData?​

any

User data. Never interpreted by the engine.

ParticleTextureOptions​

Particle texture atlas: a grid of frames (cols by rows).

Properties

cols​

number

Number of columns in the grid.

rows​

number

Number of rows in the grid.

src​

string

Atlas image URL.

ParticleTurbulenceAffectorOptions​

Turbulence — pseudo-random swirls, the most expensive affector. Prefer a smaller maxParticles on weak devices.

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

frequency?​

number

Spatial scale of the noise field, in 1/m. 0.1 by default.

speed?​

number

Evolution speed of the noise field, dimensionless. 0.5 by default.

strength?​

number

Swirl intensity in m/s^2. 5 by default.

ParticleWindAffectorOptions​

Wind: pushes particles towards the air velocity.

The attraction is inversely proportional to the particle mass, so light particles (snow, smoke) reach the wind speed quickly and heavy ones (raindrops) slowly.

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

strength?​

readonly [number, number, number]

Aerodynamic drag towards the wind velocity, per axis (dimensionless, the force is inversely proportional to mass). [30, 30, 1] by default: fast horizontal drift, vertical left mostly to gravity.

velocity​

readonly [number, number, number]

Wind velocity [x, y, z] in m/s: X — east, Y — north, Z — up.

ParticleWrapAffectorOptions​

Wraps particles inside a volume — used by weather effects to keep them near the camera.

A particle that leaves the volume re-enters from the opposite side. The volume is measured from the system anchor, not from the emitter: the emitter offset is already a part of the particle positions.

Properties

enabled?​

boolean

Enables the affector. false temporarily switches it off without removing it from the system. true by default.

volume?​

Volume configuration.

PoiIconData​

The PoiIconData event type for map events.

Properties

baseUrl?​

string

Base URL of the icon.

fullUrl?​

string

Full URL of the icon.

fullUrlUnhovered?​

string

Full URL of the unhovered icon.

height​

number

Icon height.

iconMetaphorImage?​

string

Full URL of the meta icon image.

name?​

string

Icon name.

nameUnhovered?​

string

Icon name of the unhovered icon.

width​

number

Icon width.

PointerEvent​

The basic event type for pointer-related events.

Properties

lngLat​

number[]

Geographical coordinates of the event.

originalEvent​

TouchEvent<>|MouseEvent<>

The original DOM event.

point​

number[]

Screen coordinates of the event.

PointStyleLayer​

Point style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"point"

Layer type.

Polygon3dStyleLayer​

3D polygon style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"polygon3d"

Layer type.

PolygonExtrusionStyleLayer​

Polygon extrusion style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"polygonExtrusion"

Layer type.

PolygonOptions​

Polygon initialization options.

Properties

color?​

string

Fill color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

coordinates​

number[][][]

Geographical coordinates of polygon points in format: [outerEdges, cropEdges1, cropEdges2, ...] .

The first section is outerEdges which describes an array of outer edges: [firstPoint, secondPoint, ..., firstPoint] . Each point is a geographical point: [longitude, latitude] . The last point should be the same as the first.

Then optionally you can crop some polygons from the main one (outer) by specifying cropEdges1 , cropEdges2 and so on. A format is the same as the main section: [firstPoint, secondPoint, ..., firstPoint] each point is [longitude, latitude] .

Important: outerEdges and cropEdgesN must not touch or intersect each other.

Only the first section ( outerEdges ) is required. There may be many cropEdges sections.

interactive?​

boolean

Allows the polygon to emit events (like mouseover ). true by default.

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

strokeColor?​

string

Stroke color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

strokeWidth?​

number

Stroke width in pixels.

userData?​

any

User specific data.

zIndex?​

number

Draw order.

PolygonStyleLayer​

Polygon style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"polygon"

Layer type.

PolylineOptions​

Polyline initialization options.

Properties

color?​

string

The line color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

color2?​

string

The second line color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different color.

color3?​

string

The third line color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different color.

coordinates​

number[][]

An array of polyline coordinates: [firstPoint, secondPoint, ...] . Each point is a geographical point: [longitude, latitude] .

dashLength?​

number|Expression

The length of the dash in pixels. If no dash length is specified, a polyline will be drawn.

gapColor?​

string

The gap color in hexadecimal RGB ( #ff0000 ) or RGBA ( #ff0000ff ) format.

gapLength?​

number|Expression

The length of the gap in pixels. The default gap length is equal to the dash length.

hiddenPartColor?​

string

The color of a line section that is hidden by other objects in '3d' rendering mode in RGB hexadecimal ( #ff0000 ) or RGBA ( #ff0000ff ) format.

hiddenPartGapColor?​

string

The gap color of a line section that is hidden by other objects in '3d' rendering mode in RGB hexadecimal ( #ff0000 ) or RGBA ( #ff0000ff ) format.

interactive?​

boolean

Allows the polyline to emit events (like mouseover ). true by default.

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

renderingMode?​

Rendering mode. '2d' is default.

shift?​

number

Line shift in pixels. Positive values indicate right and down, while negative values indicate left and up.

userData?​

any

User specific data.

width?​

number|Expression

The line width in pixels.

width2?​

number|Expression

The second line width in pixels.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different width.

width3?​

number|Expression

The third line width in pixels.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different width.

zIndex?​

number

Draw order of the first line.

zIndex2?​

number

Draw order of second line.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different zIndex.

zIndex3?​

number

Draw order of third line.

[DEPRECATED] Will be removed in the next major release, use additional Polyline to draw an extra line with a different zIndex.

RasterOptions​

Options for the raster.

Properties

bounds​

Raster geographical bounds in which an image will be displayed.

image​

Source image for the raster.

maxZoom?​

number

Maximum display styleZoom.

minZoom?​

number

Minimum display styleZoom.

opacity?​

number|Expression

Raster image opacity.

zIndex?​

number

Draw order.

RasterSource​

Source image for the raster.

Properties

url​

string

Url of the image for the raster.

RasterStyleLayer​

Raster style layer.

Properties

filter?​

boolean|Expression

Filter that selects objects for the layer.

id​

string

Layer identifier.

maxzoom?​

number

Maximum map zoom level for the layer.

minzoom?​

number

Minimum map zoom level for the layer.

style​

Set of style properties for the layer.

type​

"raster"

Layer type.

RasterTileSourceOptions​

RasterTileSource initialization options.

Properties

attributes?​

Data source attributes.

attribution?​

string

Contains an attribution to be displayed when the map is shown to a user.

maxZoom?​

number

The maximum zoom value for which source data exists.

minZoom?​

number

The minimum zoom value for which source data exists.

url​

(x: number, y: number, zoom: number, bbox?: LngLatBounds) => string

Convert tile coordinates to URL.

RotationAnimationOptions​

Options for map rotation animations.

Properties

animate?​

boolean

Determines if the transform should be animated.

duration?​

number

Duration of the animation in milliseconds.

easing?​

Easing function to be used with the animation.

normalize?​

boolean

If enabled, the desired rotation will be normalized to (–180°; 180°], and the direction of the rotation will be chosen so that the map makes less than half a turn. normalize: false is useful for animating one of more full turns of the map. Enabled by default.

SourceAttributes​

Data source attributes.

Properties

[key: string]​

number|string|boolean

Style​

Stub type representing the style.

Real style types will appear a little bit later.

StyleLoadErrorEvent​

Contains currently loaded error style response

Properties

style​

string|Style<>

ID or URL. Depends on the way the style was set.

StyleLoadEvent​

Contains currently loaded style response

Properties

style​

string|Style<>

Style object, ID or URL. Depends on the way the style was set.

StyleOptions​

Style options - paths to icons and fonts.

Properties

fontsPath​

string

The url to the fonts.

iconsPath​

string

The url to the icons.

modelsPath​

string

The url to the models.

stylePath?​

string

The url to the styles.

StyleSimpleIconConfig​

Config of a simple (non-stretchable) user icon.

Properties

url​

string

URL path to an icon:

  • absolute: //external.domain/some_path/some_icon.svg

  • template: //{appHost}/some_path/some_icon.svg

StyleState​

Style state. _activeFloorBuildingIds — an array of building IDs with active floor plans; _activeFloorIds — an array of active floor IDs from buildings with active floor plans; _activeFloorIsMetro — a flag which tells if active floors plan is a metro schema; _backgroundFloorIds — an array of background floor IDs (visible below active); _activeFloorsLevel — db_plan_level of active floor; trafficOn - a flag which tells if traffic is enabled; parkingOn - a flag which tells if parking is enabled (used in native version of 2gis); navigatorOn - a flag which tells if navigator is enabled (used in native version of 2gis); immersiveRoadsOn - a flag which tells if immersive roads are enabled; terrainEnabled - a flag which tells if 3d terrain is enabled; graphicsPreset - current graphics preset. Available values: 'light', 'normal', 'immersive'.

Properties

[key: string]​

number|string|boolean|number[]|string[]|object|undefined

StyleStretchableIconConfig​

Config of a stretchable user icon. The icon stretches to fit its content (e.g. text) while keeping the edges (like rounded corners) fixed.

Properties

height​

number

Height of the source icon in pixels.

stretchX​

[number, number][]

Pairs of pixel ranges along the X axis that can be stretched. For example, [[10, 30]] means pixels 0–10 and 30–width are fixed, and the region 10–30 stretches.

stretchY​

[number, number][]

Pairs of pixel ranges along the Y axis that can be stretched. For example, [[10, 20]] means pixels 0–10 and 20–height are fixed, and the region 10–20 stretches.

url​

string

URL path to an icon:

  • absolute: //external.domain/some_path/some_icon.svg

  • template: //{appHost}/some_path/some_icon.svg

width​

number

Width of the source icon in pixels.

TierOption​

Settings for drawing an object on the surface of another map object

TrafficScoreEvent​

Contains current traffic score.

Properties

score​

number

Current traffic score

TrafficVisibilityEvent​

Emitted when traffic visibility state changes

ZenithSourceOptions​

Zenith data source initialization options

Properties

idScope?​

string

Put IDs of source features to separate ID-scope. If idScope isn't specified, all IDs will be added into the "default" ID-scope. Objects that have the same ID inside ID-scope will be processed by map as one object. For example, these objects will be selected simultaneously.

Scope of the identifiers is used for objects selection, see method map.setSelectedObjects.

layerId?​

string

ID of the layer stored on the Tile Server used to fetch tiles and other resources. "layerId" overrides the tileTemplateUrl and the metatileTemplateUrl options if they are provided,

maxZoom?​

number

The maximum zoom level at which there will be zenith tiles of the source.

metatileTemplateUrl?​

string

URL template used to fetch meta-tiles. If it is provided alongside the "layerId" option, "layerId" is not used.

minZoom?​

number

The minimum zoom level at which there will be zenith tiles of the source.

promoteAttributes?​

string[]

Attributes provided to the data source by every object

promoteId?​

string

Name of the object attribute to use as id.

sourceAttributes?​

Data source attributes.

tileTemplateUrl?​

string

URL template used to fetch tiles. If it is provided alongside the "layerId" option, "layerId" is not used.

ZoomAnimationOptions​

Animation options for zoom.

Properties

animate?​

boolean

Determines if the transform should be animated.

duration?​

number

Duration of the animation in milliseconds.

easing?​

Easing function to be used with the animation.

useHeightForAnimation?​

boolean

Intermediate zoom values will be calculated using camera's height.

  • false (default): zoom values will be calculated using provided easing function.
  • true: intermediate camera height calculated then converted into zoom.

Initial and final zoom values are same for both modes, only timing function changes.

true value is useful for simultaneous animation of map's center and zoom. In that case camera will fly in a straight line.

Example: map.setCenter([82.920412, 55.030111], {easing: 'easeOutCubic', duration: 800}); map.setZoom(18, {easing: 'easeOutCubic', useHeightForAnimation: true, duration: 800});