SDK JS
    Preparing search index...

    Streams an OGC 3D-Tiles point-cloud tileset (.pnts / glTF 1.1 POINTS / cmpt, Draco or uncompressed) and renders it georeferenced — a MapLibre CustomLayerInterface, added with map.addLayer. Only id and url are required (Tiles3DPointCloudLayerOptions): tiles decode in a worker pool, the cloud auto-grounds onto the basemap or 3D terrain, and points colour by 'rgb' until another PointColorMode is set. Per-point LAS attributes survive the pipeline — Tiles3DPointCloudLayer.pickAt reports intensity, classification, returns and GPS time for the point under the cursor.

    Requires a WebGL2 context — on WebGL1 the layer goes inert and draws nothing — and renders under the mercator projection only: under a non-affine (globe) projection it hides itself.

    import { Tiles3DPointCloudLayer } from '@bitruvius/sdk-maplibre';

    map.addLayer(new Tiles3DPointCloudLayer({ id: 'lidar', url: 'https://…/tileset.json' }));

    Implements

    Index

    Constructors

    Properties

    id: string

    A unique layer id.

    renderingMode: "3d" = ...

    Either "2d" or "3d". Defaults to "2d".

    type: "custom" = ...

    The layer's type. Must be "custom".

    Methods

    • Revert to the ungraded (full-daylight) look — the clearSun half of SunLightable (used when the geo-sun system is disabled).

      Returns void

    • The dataset's attribution string, if any.

      Returns string | undefined

      The attribution option, or undefined if none was set.

    • Which PointColorModes this dataset can actually serve. 'height' always can (position is always there); the other three need their per-point attribute, and picking one the tiles do not carry renders the cloud BLACK rather than failing — so a color-mode menu should be built from this, not from the full mode list.

      Returns PointColorMode[]

      The available modes in menu order; empty until the first tile arrives (unknown, not "none"). Poll it, or build the picker from the first non-empty result.

    • The dataset's camera target [lng, lat] (degrees) — handy for driving your own flyTo.

      Returns [number, number] | null

      [lng, lat] in degrees, or null until the root center is known.

    • The colour this layer draws a classification code in — the override when one is set, else the ASPRS default. What a swatch beside a class checkbox should show.

      Parameters

      • code: number

        The LAS classification code.

      Returns Rgb

      sRGB [r, g, b], each channel 0-1.

    • The LAS classification codes present in the scene, each with a human label and point count, sorted by code — the input a class show/hide UI needs. A live histogram of resident tiles (counts grow as the scene streams). Empty when the dataset has no classification attribute. Subscribe to onClassifications to react as this fills in.

      Returns ClassificationInfo[]

    • The active colour ramp, or undefined when the built-in Turbo ramp is in use.

      Returns ColorRamp | undefined

    • The dataset's geographic footprint as [west, south, east, north] in degrees.

      Returns LayerExtent | null

      [west, south, east, north] in degrees, or null until the root resolves.

      3D Tiles declares no extent the way I3S does, so this is derived from the root bounding volume by expanding its eight corners — see extentFromObbEcef for why corners rather than a radius.

    • The z range the streamed cloud actually spans, in world ENU meters — what colorMode: 'height' auto-fits to. Seeds a height-ramp UI with real numbers instead of guesses.

      Returns [number, number] | null

      [min, max] in meters, growing as the scene streams; null before the first tile.

    • MapLibre CustomLayerInterface hook — invoked when the layer is added with map.addLayer; initializes GL resources and begins streaming.

      Parameters

      Returns void

    • MapLibre CustomLayerInterface hook — invoked when the layer is removed with map.removeLayer; releases GL resources and stops streaming.

      Returns void

    • Pick the nearest visible point under a canvas pixel. Uses the last rendered frame's matrices (valid as long as the camera is settled).

      Parameters

      • x: number

        Canvas X in CSS pixels, top-left origin (e.g. a MapLibre click event's e.point.x).

      • y: number

        Canvas Y in CSS pixels, top-left origin (e.g. e.point.y).

      Returns Tiles3DPointPickResult | null

      The picked point as a Tiles3DPointPickResult (lng/lat/height + any LAS attributes), or null on a miss / before the first frame.

    • Resolve a canvas point to the 3D position of the nearest RENDERED point — the measurement tools' screen→scene primitive (PositionPickable). Exact by construction: the picked point's stored coordinates go through the layer's placement (which embeds the vertical-datum seat), no depth reconstruction.

      Parameters

      • x: number

        Canvas X in CSS pixels, top-left origin.

      • y: number

        Canvas Y in CSS pixels, top-left origin.

      • snapRadiusPx: number = 0

        Snap radius in CSS pixels (default 0): the point nearest the cursor within the radius wins — clicks a few pixels off a sparse point still land on it.

      Returns PickedPosition | null

      The picked position (lng/lat degrees, height metres above the rendered ground datum, plus the cross-layer-comparable depth01), or null on a miss.

    • 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.

      Parameters

      Returns void

    • Working-set load fraction (0–1): drawn tiles over drawn + still-pending.

      Returns number

    • 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).

      Parameters

      Returns void

    • Sample the height of the topmost point surface at each position — the on-nadir DSM for the volume / elevation-profile tools. One overhead ortho pass over the points' bbox (StreamingPointCloudRenderer.sampleDepthGrid); each cell's top point → a height above the rendered ground datum (same frame as queryTerrainElevation). Sparse gaps read null.

      Parameters

      • points: readonly { lat: number; lng: number }[]

        lng/lat in degrees.

      • Optionalopts: SurfaceSampleOptions

        Optional: gridPx sets the overhead pass's long-axis resolution (default 1024; small values like 64 for cheap point probes).

      Returns (number | null)[]

      Height per point, or null where no point covers the cell / the layer isn't ready.

    • Geometric-error point attenuation (Cesium PointCloudShading) — size points by their node's geometric error so coarse/far points stay dense.

      Parameters

      • opts: { maxPx?: number; on?: boolean; scale?: number }

        on toggles attenuation; scale multiplies the geometric-error spacing (Cesium geometricErrorScale); maxPx caps the attenuated diameter in pixels (Cesium maximumAttenuation). Each is applied independently when set.

      Returns void

    • Resize the resident-memory budget live (the runtime equivalent of the budget ctor option). Shrinking evicts far/out-of-view nodes down to the new ceiling on the next frame; growing lets the far LOD refill.

      Parameters

      • opts: { maxBytes?: number; maxPoints?: number }

        New ceilings. maxPoints = resident-vertex cap; maxBytes = resident VRAM budget in bytes. Each is applied independently when set.

      Returns void

    • Recolour one LAS classification code, leaving the rest of the palette untouched.

      Parameters

      • code: number

        The LAS classification code (e.g. 2 = ground).

      • color: Rgb | undefined

        sRGB [r, g, b], each channel 0-1, or undefined to restore the ASPRS default.

      Returns void

      The ASPRS palette is a convention rather than a rule, and a survey's own scheme routinely disagrees with it — "building" red over a red-roofed city reads as noise. Live GPU LUT update: no re-decode, no re-stream. Only classification colour mode is affected.

    • Show or hide one LAS classification code, leaving the rest of the set untouched — the convenience over setHiddenClasses for wiring a per-class checkbox (toggle one, several, or none). Live; no re-decode/re-stream.

      Parameters

      • code: number
      • visible: boolean

      Returns void

    • Replace this layer's clipping planes at runtime. Planes are geographic (ClippingPlanesOptions) and survive re-anchors; null (or an empty or disabled set) removes clipping and restores byte-identical rendering.

      Parameters

      Returns void

    • Replace the colour ramp used by the intensity and height colour modes.

      Parameters

      • ramp: ColorRamp | undefined

        Stops (or a bare colour list spaced evenly), or undefined for Turbo.

      Returns void

      Turbo is a good default for LiDAR intensity and a poor one for a printed figure, a colour-blind reader, or a house style. Stops interpolate linearly in sRGB and need not be sorted; outside the end stops the ramp holds rather than fades. Live GPU LUT update.

      layer.setColorRamp([[0.05, 0.05, 0.2], [0.9, 0.9, 1]]); // dark blue → white
      layer.setColorRamp(undefined); // back to Turbo
    • Switch the vertical-datum placement live (rigid vertical shift; no re-stream).

      Parameters

      Returns void

    • Toggle the DEBUG tile bounding-volume (OBB) wireframe overlay.

      Parameters

      • on: boolean

        true to draw the OBB overlay, false to hide it.

      Returns void

    • Eye-dome lighting (Cesium/Potree EDL) — a screen-space pass that shades depth gaps so a sparse cloud reads as a solid surface. on toggles; strength/radius tune.

      Parameters

      • opts: { on?: boolean; radius?: number; strength?: number }

      Returns void

    • Pin the colorMode: 'height' ramp floor/ceiling, in world ENU meters. By default the ramp auto-fits to the streamed z range, which DRIFTS as tiles load and evict — pin it to stop the colors shifting under the viewer, or to stretch a shallow range.

      Parameters

      • range: { max?: number | null; min?: number | null }

        min / max in meters; pass null for either to go back to auto-fitting that end. Seed the inputs from getHeightRange.

      Returns void

    • Replace the hidden-class set (LAS codes). Live GPU mask update — no re-stream.

      Parameters

      • classes: readonly number[]

      Returns void

    • The intensity → ramp mapping used by colorMode: 'intensity': t = i * scale + bias, where i is the raw u16 intensity. The default scale of 1/65535 spans the full u16 range, so a survey that only uses the low end of it comes out nearly black until the scale is raised.

      Parameters

      • opts: { bias?: number; scale?: number }

        scale multiplies the raw intensity; bias offsets the result. Each is applied independently when set.

      Returns void

    • Set the LOD distance-falloff exponent live (1 = standard SSE / Cesium-matched cusp).

      Parameters

      • pow: number

      Returns void

    • Parameters

      • px: number

      Returns void

    • Fade the points over the basemap.

      Parameters

      • opacity: number

        Opacity in [0, 1] (clamped); 0 = transparent, 1 = opaque.

      Returns void

    • Adjust point sizing: fixedPx > 0 = constant pixel size; else perspective attenuation from pointRadiusM clamped to [minPx, maxPx].

      Parameters

      • opts: { fixedPx?: number; maxPx?: number; minPx?: number; pointRadiusM?: number }

      Returns void

    • Draw round (vs square) points — rounder reads better on a sparse cloud.

      Parameters

      • on: boolean

      Returns void

    • Toggle cascaded sun shadows (cast + self-shadow) at runtime. Part of @bitruvius/sdk-maplibre's SunLightable, so atmo.setShadows(...) reaches this layer.

      Parameters

      • on: boolean

      Returns void

    • Adopt (or clear) the shared vector-drape atlas — satisfies the DrapeReceiver contract, so enableVectorDrape drives this layer directly. Stashed until the renderer exists.

      Parameters

      • shared: SharedDrape | null

      Returns void

    • Grade the point cloud by the environment (day/night exposure + sun tint) — satisfies @bitruvius/sdk-maplibre's SunLightable. Point clouds carry no normals → color grade only.

      Parameters

      Returns void

    • Show/hide the layer without removing it (streaming continues).

      Parameters

      • visible: boolean

        true to show, false to hide.

      Returns void

    • Live streaming + render stats for a debug HUD / perf overlay.

      Returns PointEngineStats & { colorMode: PointColorMode; drawn: number } | null

      The engine's PointEngineStats plus drawn (points rendered last frame) and the active colorMode, or null until the engine is up.