Search

Mapbox

MapWeave

The functions available for MapWeave when used with the Mapbox adapter.

Creates a new MapWeave instance in your webpage using the options specified.

Parameters

def
optional
object

Specifies the container and the values for the MapWeave instance to be created.

string | HTMLElement

The id or DOM element that will contain the MapWeave canvas and any overlays.

The initial options to be set on the MapWeave instance.

Returns MapWeave

readonly
Map

Readonly access to the Mapbox Map object.

Creates a new layer.

Parameters

Layer

Defines the layer to be added. The new layer can be one of the following:

Returns void

Destroys the MapWeave instance. This will remove the MapWeave instance and any adapter specific elements from the DOM and free any allocated resources.

Returns void

Fits the map to the bounds of all visible layers or to the options specified.

Parameters

options
optional

The options to use for fitting the map.

Returns Promise<void>

Animates a transition to a defined point on the map. Retains the current values for any options not specified.

Parameters

The center of the map to fly to.

options
optional

The options to use for the fly transition.

Returns Promise<void>

Gets or sets the current MapWeave layers. If used as a setter, the layers will be rendered in the order that they are specified in the array, and any existing layers not present in the array will be removed.

Parameters

layers
optional
Layer<any, any, any>[]

An array of layers to attach to the adapter.

Returns Layer<any, any, any>[]

An array of objects describing the current MapWeave layers.

Detaches an event handler from an event fired by MapWeave. See the Event Handling docs for more information.

Parameters

string

The name of the event.

Function

The handler function for the event.

Returns void

Attaches an event handler to an event fired by MapWeave. See the Event Handling docs for more information.

Parameters

string

The name of the event.

Function

The handler function for the event.

Returns void

Gets or sets the MapWeave options while preserving any other previously set options.

Parameters

options
optional

The MapWeave options to set.

Returns object

An object containing all the MapWeave options and their current values.

Removes a MapWeave layer.

Parameters

Layer

Defines the MapWeave layer to be removed.

Returns void

Sets the MapWeave options while resetting any other previously set options to default values.

Parameters

options
optional

The MapWeave options to set.

Returns void

Gets or sets the current MapWeave viewport.

Parameters

viewState
optional

An object describing the view state.

Returns SizedViewState

The MapWeave sizedViewState object.

MapWeaveOptions

accessToken

optional
string

The Mapbox access token. See the Mapbox Access Tokens docs for more information.

maxZoom

optional
number default: 20

Sets the maximum zoom level, which controls how far the map can zoom in.

number default: 0

The radius of a circle around the pointer used to detect interactions in pixels.

style

optional
string default: 'mapbox://styles/mapbox/dark-v11'

The Mapbox style URL. See the Mapbox Styles API for more information.

boolean default: false

Enables view rotation if set to true.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.