Create the layer. The atlas is uploaded and the instances packed in onAdd.
See BillboardInstancesLayerOptions. id, atlas and a non-empty
instances are required.
ReadonlyidA unique layer id.
ReadonlyrenderingEither "2d" or "3d". Defaults to "2d".
ReadonlytypeThe layer's type. Must be "custom".
The anchor [lng, lat] (instances' centroid).
[lng, lat] in degrees, or null until loaded.
MapLibre CustomLayerInterface hook — invoked when the layer is added with map.addLayer;
uploads the atlas and packs the instances.
MapLibre CustomLayerInterface hook — invoked when the layer is removed with map.removeLayer;
releases GL resources.
Pick the billboard under a CSS pixel (uses the last rendered frame).
Canvas X in CSS pixels, top-left origin (e.g. a MapLibre click event's e.point.x).
Canvas Y in CSS pixels, top-left origin (e.g. e.point.y).
The BillboardPickHit under the cursor, or null on a miss / before the first frame.
Optional method called during a render frame to allow a layer to prepare resources or render into a texture.
The layer cannot make any assumptions about the current GL state and must bind a framebuffer before rendering.
Called during a render frame allowing the layer to draw into the GL context.
The layer can assume blending and depth state is set to allow the layer to properly blend and clip other layers. The layer cannot make any other assumptions about the current GL state.
If the layer needs to render to a texture, it should implement the prerender method
to do this and only use the render method for drawing directly into the main framebuffer.
The blend function is set to gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA). This expects
colors to be provided in premultiplied alpha form where the r, g and b values are already
multiplied by the a value. If you are unable to provide colors in premultiplied form you
may want to change the blend function to
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA).
Fade the billboards over the basemap.
Opacity in [0, 1] (clamped); 0 = transparent, 1 = opaque.
Show/hide the layer without removing it.
true to show, false to hide.
Draws screen-facing icon billboards at many geographic points, all in one instanced pass. An "instance" is a BillboardInstance — a
[lng, lat, height]position, asymbolIdindexing the shared sprite atlas, and an optional heading added to that symbol's own rotation — so the caller supplies two things: the atlas (itsimageplus thesymbolsUV table) and the instance list. The layer anchors at the instances' centroid, packs them into a quantized ENU tile, and draws each sprite at the size its atlas entry declares. Add it withmap.addLayer; it needs a WebGL2 context (on WebGL1 it draws nothing rather than throwing) and Mercator — a non-affine (globe) frame hides it. Heights are used exactly as given; this layer does not sample terrain.Example
See