Class

Mapbox2DLayer

Mapbox2DLayer()

Constructor

# new Mapbox2DLayer()

A custom Mapbox layer for rendering 2D images on the map using Three.js and WebGL.

Methods

# onAdd(map, gl)

This method is called when the layer is added to the Map with Map#addLayer. This gives the layer a chance to initialize gl resources and register event listeners.
Parameters:
Name Type Description
map mapboxgl.Map The Map this custom layer was just added to.
gl WebGLRenderingContext The gl context for the map.

# render(gl, matrix)

Called during a render frame allowing the layer to draw into the GL context.
Parameters:
Name Type Description
gl WebGLRenderingContext The map's gl context.
matrix Array:.<number:> The map's camera matrix.

# setData(features)

Sets the GeoJSON data and re-renders the layer.
Parameters:
Name Type Description
features Array:.<GeoJSON.Feature:>