Skip to main content

WemapMapOptions

wemap-sdk-js


Interface: WemapMapOptions

Options for WemapMap.

Call core.init() before constructing a map — snippet defaults (style, bounds, indoor, …) are merged in automatically; constructor values override them when both are set.

Extends maplibre's MapOptions (so every native option is available) and refines a few for convenience.

Extends

  • Omit<MapOptions, "center" | "bounds" | "maxBounds">

Properties

anisotropicFilterPitch?

optional anisotropicFilterPitch?: number | null

The pitch above which to apply anisotropic filtering to the map's raster layers (0-180).

Default Value

20

Inherited from

Omit.anisotropicFilterPitch


aroundCenter?

optional aroundCenter?: boolean

Determines the rotation interaction model:

  • When true: Uses "Orbital" logic where rotation is relative to the pivot center. Dragging right at the top rotates clockwise, while dragging right at the bottom rotates counter-clockwise (like spinning a physical globe).
  • When false: Uses "Linear" logic where horizontal mouse movement translates directly to bearing change regardless of cursor position.

Inherited from

Omit.aroundCenter


attributionControl?

optional attributionControl?: false | AttributionControlOptions

If set, an AttributionControl will be added to the map with the provided options. To disable the attribution control, pass false. !!! note Showing the logo of MapLibre is not required for using MapLibre.

Default Value

compact: true, customAttribution: "MapLibre ...".

Inherited from

Omit.attributionControl


autoResize?

optional autoResize?: boolean

When true, observe the container and call map.resize() whenever its size changes. Detached automatically in WemapMap.remove.


bearing?

optional bearing?: number

The initial bearing (rotation) of the map, measured in degrees counter-clockwise from north. If bearing is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.

Default Value

0

Inherited from

Omit.bearing


bearingSnap?

optional bearingSnap?: number

The threshold, measured in degrees, that determines when the map's bearing will snap to north. For example, with a bearingSnap of 7, if the user rotates the map within 7 degrees of north, the map will automatically snap to exact north.

Default Value

7

Inherited from

Omit.bearingSnap


bounds?

optional bounds?: BoundingBox

Initial bounds the map fits on load. Takes precedence over center/zoom, mirroring maplibre. Accepts a BoundingBox.


boxZoom?

optional boxZoom?: boolean | BoxZoomHandlerOptions

If true, the "box zoom" interaction is enabled (see BoxZoomHandler). An Object value configures BoxZoomHandler options. If boxZoomEnd is provided, the callback runs instead of the default fit-to-box zoom.

Default Value

true

Inherited from

Omit.boxZoom


cancelPendingTileRequestsWhileZooming?

optional cancelPendingTileRequestsWhileZooming?: boolean

Determines whether to cancel, or retain, tiles from the current viewport which are still loading but which belong to a farther (smaller) zoom level than the current one.

  • If true, when zooming in, tiles which didn't manage to load for previous zoom levels will become canceled. This might save some computing resources for slower devices, but the map details might appear more abruptly at the end of the zoom.
  • If false, when zooming in, the previous zoom level(s) tiles will progressively appear, giving a smoother map details experience. However, more tiles will be rendered in a short period of time.

Default Value

true

Inherited from

Omit.cancelPendingTileRequestsWhileZooming


canvasContextAttributes?

optional canvasContextAttributes?: WebGLContextAttributesWithType

Set of WebGLContextAttributes that are applied to the WebGL context of the map. See https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext for more details. contextType is restricted to 'webgl2'. This option is kept as a forward-looking API for future WebGPU support.

Default Value

antialias: false, powerPreference: 'high-performance', preserveDrawingBuffer: false, failIfMajorPerformanceCaveat: false, desynchronized: false, contextType: 'webgl2'

Inherited from

Omit.canvasContextAttributes


center?

optional center?: LatLngLike

Initial map center.


centerClampedToGround?

optional centerClampedToGround?: boolean

If true, the elevation of the center point will automatically be set to the terrain elevation (or zero if terrain is not enabled). If false, the elevation of the center point will default to sea level and will not automatically update. Defaults to true. Needs to be set to false to keep the camera above ground when pitch > 90 degrees.

Inherited from

Omit.centerClampedToGround


clickTolerance?

optional clickTolerance?: number

The max number of pixels a user can shift the mouse pointer during a click for it to be considered a valid click (as opposed to a mouse drag).

Default Value

3

Inherited from

Omit.clickTolerance


collectResourceTiming?

optional collectResourceTiming?: boolean

If true, Resource Timing API information will be collected for requests made by GeoJSON and Vector Tile web workers (this information is normally inaccessible from the main Javascript thread). Information will be returned in a resourceTiming property of relevant data events.

Default Value

false

Inherited from

Omit.collectResourceTiming


container

container: string | HTMLElement

The HTML element in which MapLibre GL JS will render the map, or the element's string id. The specified element must have no children.

Inherited from

Omit.container


cooperativeGestures?

optional cooperativeGestures?: boolean

If true or set to an options object, the map is only accessible on desktop while holding Command/Ctrl and only accessible on mobile with two fingers. Interacting with the map using normal gestures will trigger an informational screen. With this option enabled, "drag to pitch" requires a three-finger gesture. Cooperative gestures are disabled when a map enters fullscreen using FullscreenControl.

Default Value

false

Inherited from

Omit.cooperativeGestures


crossSourceCollisions?

optional crossSourceCollisions?: boolean

If true, symbols from multiple sources can collide with each other during collision detection. If false, collision detection is run separately for the symbols in each source.

Default Value

true

Inherited from

Omit.crossSourceCollisions


doubleClickZoom?

optional doubleClickZoom?: boolean

If true, the "double click to zoom" interaction is enabled (see DoubleClickZoomHandler).

Default Value

true

Inherited from

Omit.doubleClickZoom


dragPan?

optional dragPan?: boolean | DragPanOptions

If true, the "drag to pan" interaction is enabled. An Object value is passed as options to DragPanHandler.enable.

Default Value

true

Inherited from

Omit.dragPan


dragRotate?

optional dragRotate?: boolean

If true, the "drag to rotate" interaction is enabled (see DragRotateHandler).

Default Value

true

Inherited from

Omit.dragRotate


elevation?

optional elevation?: number

The elevation of the initial geographical centerpoint of the map, in meters above sea level. If elevation is not specified in the constructor options, it will default to 0.

Default Value

0

Inherited from

Omit.elevation


fadeDuration?

optional fadeDuration?: number

Controls the duration of the fade-in/fade-out animation for label collisions after initial map load, in milliseconds. This setting affects all symbol layers. This setting does not affect the duration of runtime styling transitions or raster tile cross-fading.

Default Value

300

Inherited from

Omit.fadeDuration


fitBoundsOptions?

optional fitBoundsOptions?: FitBoundsOptions

A FitBoundsOptions options object to use only when fitting the initial bounds provided above.

Inherited from

Omit.fitBoundsOptions


hash?

optional hash?: string | boolean

If true, the map's position (zoom, center latitude, center longitude, bearing, and pitch) will be synced with the hash fragment of the page's URL. For example, https://example.com#2.59/39.26/53.07/-24.1/60.

An additional string may optionally be provided as an alternative to indicate a parameter-styled hash. For example, passing hash: "foo" will produce a hash like https://example.com#foo=2.59/39.26/53.07/-24.1/60. This is usefull for allowing multiple maps or other state.

Default Value

false

Inherited from

Omit.hash


indoor?

optional indoor?: WemapMapIndoorOptions

Override snippet indoor settings. When omitted, indoor.enable and indoor.minZoom from the livemap snippet apply after core.init().


indoorLayerFilter?

optional indoorLayerFilter?: IndoorLayerPredicate

Predicate deciding which style layers react to WemapMap.setLevel. Defaults to layers whose id starts with indoor.


interaction?

optional interaction?: WemapMapInteractionOptions

Opt-in automatic POI userflow: click-to-select and search highlight/filter. Off by default. See WemapMapInteractionOptions.


interactive?

optional interactive?: boolean

If false, no mouse, touch, or keyboard listeners will be attached to the map, so it will not respond to interaction.

Default Value

true

Inherited from

Omit.interactive


keyboard?

optional keyboard?: boolean

If true, keyboard shortcuts are enabled (see KeyboardHandler).

Default Value

true

Inherited from

Omit.keyboard


level?

optional level?: number

Initial level to display once the style has loaded.


locale?

optional locale?: Record<string, string>

A patch to apply to the default localization table for UI strings, e.g. control tooltips. The locale object maps namespaced UI string IDs to translated strings in the target language; see src/ui/default_locale.js for an example with all supported string IDs. The object may specify all UI strings (thereby adding support for a new translation) or only a subset of strings (thereby patching the default translation table). For an example, see https://maplibre.org/maplibre-gl-js/docs/examples/locale-switching/ Alternatively, search the official plugins page for plugins related to localization.

Default Value

null

Inherited from

Omit.locale


localIdeographFontFamily?

optional localIdeographFontFamily?: string | false

Defines a CSS font-family for locally overriding generation of Chinese, Japanese, and Korean characters. For these characters, font settings from the map's style will be ignored, except for font-weight keywords (light/regular/medium/bold). Set to false, to enable font settings from the map's style for these glyph ranges. The purpose of this option is to avoid bandwidth-intensive glyph server requests.

See

Use locally generated ideographs

Default Value

'sans-serif'

Inherited from

Omit.localIdeographFontFamily


logoPosition?

optional logoPosition?: ControlPosition

A string representing the position of the MapLibre wordmark on the map. Valid options are top-left,top-right, bottom-left, or bottom-right.

Default Value

'bottom-left'

Inherited from

Omit.logoPosition


optional maplibreLogo?: boolean

If true, the MapLibre logo will be shown.

Inherited from

Omit.maplibreLogo


maxBounds?

optional maxBounds?: BoundingBox

Bounds the camera is constrained to. Accepts a BoundingBox.


maxCanvasSize?

optional maxCanvasSize?: [number, number]

The canvas' width and height max size. The values are passed as an array where the first element is max width and the second element is max height. You shouldn't set this above WebGl MAX_TEXTURE_SIZE.

Default Value

[4096, 4096].

Inherited from

Omit.maxCanvasSize


maxPitch?

optional maxPitch?: number | null

The maximum pitch of the map (0-180).

Default Value

60

Inherited from

Omit.maxPitch


maxTileCacheSize?

optional maxTileCacheSize?: number | null

The maximum number of tiles stored in the tile cache for a given source. If omitted, the cache will be dynamically sized based on the current viewport which can be set using maxTileCacheZoomLevels constructor options.

Default Value

null

Inherited from

Omit.maxTileCacheSize


maxTileCacheZoomLevels?

optional maxTileCacheZoomLevels?: number

The maximum number of zoom levels for which to store tiles for a given source. Tile cache dynamic size is calculated by multiplying maxTileCacheZoomLevels with the approximate number of tiles in the viewport for a given source.

Default Value

5

Inherited from

Omit.maxTileCacheZoomLevels


maxZoom?

optional maxZoom?: number | null

The maximum zoom level of the map. Users cannot zoom in beyond this level. (0–24)

Default Value

22

Inherited from

Omit.maxZoom


minPitch?

optional minPitch?: number | null

The minimum pitch of the map (0-180).

Default Value

0

Inherited from

Omit.minPitch


minZoom?

optional minZoom?: number | null

The minimum zoom level of the map. Users cannot zoom out beyond this level. (0–24)

Default Value

0

Inherited from

Omit.minZoom


pitch?

optional pitch?: number

The initial pitch (tilt) of the map, measured in degrees away from the plane of the screen (0-85). If pitch is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0. Values greater than 60 degrees are experimental and may result in rendering issues. If you encounter any, please raise an issue with details in the MapLibre project.

Default Value

0

Inherited from

Omit.pitch


pitchWithRotate?

optional pitchWithRotate?: boolean

If false, the map's pitch (tilt) control with "drag to rotate" interaction will be disabled.

Default Value

true

Inherited from

Omit.pitchWithRotate


pixelRatio?

optional pixelRatio?: number

The pixel ratio. The canvas' width attribute will be container.clientWidth * pixelRatio and its height attribute will be container.clientHeight * pixelRatio. Defaults to devicePixelRatio if not specified.

Inherited from

Omit.pixelRatio


reduceMotion?

optional reduceMotion?: boolean

If true, gesture inertia (such as panning) is disabled. If not provided, gesture inertia defaults to the user's device settings.

Default Value

undefined

Inherited from

Omit.reduceMotion


refreshExpiredTiles?

optional refreshExpiredTiles?: boolean

If false, the map won't attempt to re-request tiles once they expire per their HTTP cacheControl/expires headers.

Default Value

true

Inherited from

Omit.refreshExpiredTiles


renderWorldCopies?

optional renderWorldCopies?: boolean

If true, multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If set to false:

  • When the map is zoomed out far enough that a single representation of the world does not fill the map's entire container, there will be blank space beyond 180 and -180 degrees longitude.
  • Features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the map and the other on the left edge of the map) at every zoom level.

Default Value

true

Inherited from

Omit.renderWorldCopies


roll?

optional roll?: number

The initial roll angle of the map, measured in degrees counter-clockwise about the camera boresight. If roll is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.

Default Value

0

Inherited from

Omit.roll


rollEnabled?

optional rollEnabled?: boolean

If false, the map's roll control with "drag to rotate" interaction will be disabled.

Default Value

false

Inherited from

Omit.rollEnabled


scrollZoom?

optional scrollZoom?: boolean | AroundCenterOptions

If true, the "scroll to zoom" interaction is enabled. AroundCenterOptions are passed as options to ScrollZoomHandler.enable.

Default Value

true

Inherited from

Omit.scrollZoom


style?

optional style?: string | StyleSpecification

The map's MapLibre style. This must be a JSON object conforming to the schema described in the MapLibre Style Specification, or a URL to such JSON. When the style is not specified, calling Map.setStyle is required to render the map.

Inherited from

Omit.style


terrainSkirtLength?

optional terrainSkirtLength?: "auto" | "none"

Controls the length of the vertical extensions which are added to the edges of terrain tiles.

If the skirts are introducing visually unappealing vertical artifacts, consider avoiding transparent or semi-transparent backgrounds, for example, by having the first layer be a background layer with a background-color. If that is impossible or insufficient, you can entirely disable skirts, at the cost of potentially introducing some horizontal hairline gaps (stitches) on tile boundaries with different zoomlevels for some terrain datasets.

  • "none" disables skirts entirely.
  • "auto" renders skirts with an automatically chosen length.

Default Value

"auto"

Inherited from

Omit.terrainSkirtLength


touchPitch?

optional touchPitch?: boolean | AroundCenterOptions

If true, the "drag to pitch" interaction is enabled. An Object value is passed as options to TwoFingersTouchPitchHandler.enable.

Default Value

true

Inherited from

Omit.touchPitch


touchZoomRotate?

optional touchZoomRotate?: boolean | AroundCenterOptions

If true, the "pinch to rotate and zoom" interaction is enabled. An Object value is passed as options to TwoFingersTouchZoomRotateHandler.enable.

Default Value

true

Inherited from

Omit.touchZoomRotate


trackResize?

optional trackResize?: boolean

If true, the map will automatically resize when the browser window resizes.

Default Value

true

Inherited from

Omit.trackResize


transformCameraUpdate?

optional transformCameraUpdate?: CameraUpdateTransformFunction | null

A callback run before the map's camera is moved due to user input or animation. The callback can be used to modify the new center, zoom, pitch and bearing. Expected to return an object containing center, zoom, pitch or bearing values to overwrite.

Default Value

null

Inherited from

Omit.transformCameraUpdate


transformConstrain?

optional transformConstrain?: TransformConstrainFunction | null

A callback that overrides how the map constrains the viewport's lnglat and zoom to respect the longitude and latitude bounds.

See

Customize the map transform constrain Expected to return an object containing center and zoom.

Default Value

null

Inherited from

Omit.transformConstrain


transformRequest?

optional transformRequest?: RequestTransformFunction | null

A callback run before the Map makes a request for an external URL. The callback can be used to modify the url, set headers, or set the credentials property for cross-origin requests. Expected to return an object with a url property and optionally headers and credentials properties.

Default Value

null

Inherited from

Omit.transformRequest


validateStyle?

optional validateStyle?: boolean

If false, style validation will be skipped. Useful in production environments due to enabling tree-shaking of the validation code in some environments and minor performance improvements. Disabling this option comes at the cost of less clear error messages

Default Value

true

Inherited from

Omit.validateStyle


zoom?

optional zoom?: number

The initial zoom level of the map. If zoom is not specified in the constructor options, MapLibre GL JS will look for it in the map's style object. If it is not specified in the style, either, it will default to 0.

Default Value

0

Inherited from

Omit.zoom


zoomLevelsToOverscale?

optional zoomLevelsToOverscale?: number

Defines the number of zoom level that will overscale instead of split tiles below (inclusive) a map's maxZoom. When undefined, all zoom levels after source's max zoom will be overscaled.

This can help in reducing the size of the overscaling and improve performance in high zoom levels. The drawback is that it changes rendering for polygon centered labels and changes the results of query rendered features.

For example if map's maxZoom is 20, the source's maxzoom is 10 (tiles are avaliable until zoom 10) and zoomLevelsToOverscale is set to 3:

  • The zoom levels of 20, 19, 18 will be overscaled.
  • The zoom levels 11 to 17 will be split.

Default Value

4

Inherited from

Omit.zoomLevelsToOverscale


zoomSnap?

optional zoomSnap?: number

The step increment the zoom level will snap to. For example, if zoomSnap is 1, the map will snap to whole integers during discrete zoom operations. If set to 0, zooming is continuous.

Default Value

0

Inherited from

Omit.zoomSnap