MapOptions | MapGL | 2GIS Documentation
MapGL JS API

MapOptions

Map initialization options.

Properties
undefinedfalsetrue

Enables OSM copyright auto hide after 5 sec

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

number[]

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

Partial<Padding>

Sets padding for controls layout

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

undefinedstring

Sets default background color, while style is loading

undefinedfalsetrue

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

undefinedfalsetrue

Prevents the map from dragging.

undefinedfalsetrue

Prevents users from pitching the map.

undefinedfalsetrue

Prevents users from rotating the map.

undefinedfalsetrue

Disables map zoom on scrolling over the map container.

undefinedfalsetrue

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

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.

undefinedfalsetrue

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

undefinedstring

The key that allows usage of the API.

undefinedstring

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

undefinednumber

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

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

undefinednumber

Maximum map pitch in degrees.

undefinednumber

Maximum map styleZoom.

undefinednumber

Minimum map pitch in degrees.

undefinednumber

Minimum map styleZoom.

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

undefinednumber

Map pitch in degrees.

undefinedfalsetrue

Sets preserveDrawingBuffer option to WebGLRenderingContext.

undefinednumber

Map rotation in degrees.

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.

undefinedstring

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

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.

Map style global variables

undefinednumber

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.

undefinednumber

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

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.

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

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

undefinednumber

Map zoom.

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