MapOptions | MapGL | 2GIS Documentation
MapGL JS API

MapOptions

Map initialization options.

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

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

string

Sets default background color, while style is loading

boolean

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

boolean

Prevents the map from dragging.

boolean

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

boolean

Prevents users from pitching the map.

boolean

Disable render caching.

boolean

Prevents users from rotating the map.

boolean

Disables map zoom on scrolling over the map container.

boolean

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

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.

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.

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.

light

  • light graphics preset

normal

  • normal graphics preset

immersive

  • immersive graphics preset

auto

  • EXPERIMENTAL graphics preset will be set depending on benchmark result
boolean

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

string

The key that allows usage of the API.

string

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

boolean

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

number

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

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

number

Maximum map pitch in degrees.

number

Maximum map styleZoom.

number

Minimum map pitch in degrees.

number

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

number

Map pitch in degrees.

boolean

Sets preserveDrawingBuffer option to WebGLRenderingContext.

number

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.

string

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

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.

number

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.

number

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.