Skip to main content

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.

BinaryFeatureStateMap

Binary representation of featureStateMap. Contains usual FeatureStateMap data packed by [@2gis/json2pbf](https://github.com/2gis/json2pbf) library Example: ```js 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` .

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.
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.
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]
numberstringbooleannull

FeatureStateMap

FeatureStateMap source attributes. Example: ```js 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.
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.
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?
stringnumber
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
undefinedboolean
globeOff
undefinedboolean
immersiveRoadsOff
undefinedboolean
modelsOff
undefinedboolean
shadowsOff
undefinedboolean
skyOff
undefinedboolean

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
stringHTMLElement<>
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.

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?
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?
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.

Layer

Stub type representing the style layer. Real style layer types will appear a little bit later.

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.
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
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.
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
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?
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?
Text color in hexadecimal RGB ( `#ff0000` ) or RGBA ( `#ff0000ff` ) format.
fontSize?
number
Text size.
haloColor?
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?
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?
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.

Padding

Padding in pixels on different sides of the container.
Properties
bottom
number
Bottom padding in pixels.
left
number
Left padding in pixels.
number
Right padding in pixels.
top
number
Top padding in pixels.

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.

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.

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?
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?
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.
userData?
any
User specific data.
width?
The line width in pixels.
width2?
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?
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?
Raster image opacity.
zIndex?
number
Draw order.

RasterSource

Source image for the raster.
Properties
url
string
Url of the image for the raster.

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]
numberstringboolean

Style

Stub type representing the style. Real style types will appear a little bit later.

StyleIconConfig

Config of an original user icon. Only SVG images are supported.
Properties
url
string
URL path to an icon: - absolute: `//external.domain/some_path/some_icon.svg` - template: `//{appHost}/some_path/some_icon.svg`

StyleLoadErrorEvent

Contains currently loaded error style response
Properties
style
stringStyle<>
ID or URL. Depends on the way the style was set.

StyleLoadEvent

Contains currently loaded style response
Properties
style
stringStyle<>
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.

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; 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]
numberstringbooleannumber[]string[]objectundefined

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});