L.mapboxGL(options)
Create a new Mapbox GL layer in a Leaflet-compatible wrapper.
Extends: L.Class
options
is an object of options. All options given are passed to a Mapbox GL Map
object,
so consult the Mapbox GL .Map documentation
for the full range.
Option | Value | Description | |
---|---|---|---|
accessToken | string | Required: a Mapbox access token to identify requests for map resources | |
padding | number | [0.15] | Relative padding of the mapbox-gl layer to avoid the background flickering around the edges of the map |
interactive | boolean | [false] | Wheter or not to register the mouse and keyboard events on the mapbox-gl layer. Turn this on if you intend to use the mapbox-gl layer events. |
layer.addTo(map)
Same behavior as .addTo
on any Leaflet layer: this adds the layer to a given
map or group.
layer.getMapboxMap(): mapbox.Map
Returns mapbox-gl.Map
object.
layer.getContainer(): HTMLDivElement
Returns layer’s DOM container div
.
layer.getCanvas(): HTMLCanvasElement
Returns mapbox-gl.Map
canvas.
layer.getSize(): L.Point
Returns layer size in pixels including padding.
layer.getBounds(): L.LatLngBounds
Returns layer bounds including padding.