SDK JS
    Preparing search index...

    An Esri I3S Integrated Mesh Scene Layer. See the module docs above for why this exists as its own name while sharing I3sMeshLayer's implementation.

    Hierarchy (View Summary)

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

    Accessors

    • get datumRepairMetres(): number

      The MEASURED datum repair currently applied, in metres (see I3sMeshLayerOptions.datumRepair).

      0 — the overwhelmingly common case — means the layer is placed exactly where the service says, either because the declaration checked out or because the repair never ran. A non-zero value means the service's declared vertical datum was proven false against the 3D terrain and the mesh was shifted by this much to seat on its own ground (Vienna: +156.3). Read it to verify placement, or to surface the correction in your own UI; it never changes after the one-shot measurement settles.

      Returns number

    Methods

    • Revert to the default (no-sun) lighting — the clearSun half of SunLightable (used when the geo-sun system is disabled). Clearing lastSun also gates off the cast-shadow pass.

      Returns void

    • Representative ellipsoidal elevation (m) of the rendered data — for framing the camera at the data's height WITHOUT terrain (the data is placed absolutely). null when nothing is rendered yet.

      Returns number | null

    • The service's published attribute fields, for building a symbology UI.

      Returns { name: string; valueType: string }[]

    • The service's own statistics for one attribute — what a symbology UI needs to offer anything honest about a field it has never seen.

      Parameters

      Returns Promise<I3sAttributeStats | null>

      The statistics, or null when the service publishes none for this field (or the fetch fails — a symbology panel degrades to "no range known", it does not break).

      I3S publishes statisticsInfo per attribute, and what comes back DIFFERS BY TYPE: a numeric field summarises to { min, max, count, avg, stddev }, a string field to a list of values with counts. That is exactly the difference between the two symbology renderers — class breaks over a range, or a colour per value — so the shape of the answer tells a caller which to build, without anyone hardcoding a field name.

      Not every attribute has statistics. Object-id columns typically publish none, and a field the service never summarised returns null rather than a guessed range: inventing 0..100 for a column of parcel ids produces five class breaks that all contain everything.

    • The dataset's attribution string, if any. Wire it into MapLibre's AttributionControl (e.g. new AttributionControl({ customAttribution })) or your UI — this layer does NOT auto-register a geojson attribution source (an empty source destabilizes MapLibre's source-cache / tile-coverage when multiple custom layers coexist over 3D terrain).

      Returns string | undefined

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

    • The dataset's geographic footprint as [west, south, east, north] in degrees, read from the service document and normalised out of whatever CRS it was published in.

      Returns LayerExtent | null

      [west, south, east, north] in degrees, or null before the service document resolves — or after, if the service published no extent (or one in a CRS the reader cannot invert; a missing footprint is reported rather than guessed).

      The difference from getCenter is what you can DECIDE with it. A centre answers "where do I point the camera"; a footprint answers "is this dataset on screen at all", which is what lets a caller holding many layers order them by distance, frame them together, and give resident memory to the ones actually in view instead of dividing it evenly and starving the one being looked at.

    • The currently selected key value, or null.

      Returns string | number | null

    • Whether this layer extracted hard edges at all — false when constructed without edges, in which case I3sMeshLayer.setEdges has nothing to draw.

      Returns boolean

    • 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 3DObject feature under canvas pixel (x, y) (top-left origin, e.g. from a MapLibre click event's e.point). Renders an offscreen feature-id pass over the visible tiles, reads back the hit, then fetches + decodes that feature's per-feature attributes. Returns null on a miss (no mesh under the cursor). Async: the attribute blobs are fetched on demand.

      Parameters

      • x: number
      • y: number

      Returns Promise<I3sPickedFeature | null>

    • Resolve a canvas point to the 3D geographic position of the frontmost rendered mesh surface — the screen→scene primitive behind measurement and slice placement. GPU pick pass + window-depth readback, reconstructed through the inverse frame matrix.

      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.

      • snapRadiusPx: number = 0

        Snap radius in CSS pixels (default 0 = exact pixel): the nearest mesh hit within the radius wins, so a click slightly off an edge still lands on the mesh.

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

      Parameters

      Returns void

    • Working-set load fraction (0–1): drawn tiles over drawn plus still-pending (loading/in-flight/queued). 1 once the current view is fully resolved.

      Returns number

      The fraction, or 0 before the engine exists.

    • 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 this layer's topmost rendered surface at each position — ONE synthetic top-down orthographic pick pass over the stations' bbox, then a per-station grid lookup (the "buildings" line on an elevation profile). Samples the currently-RESIDENT tiles; positions in unloaded areas return 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), marginM the padding around the stations, and maxHeightM a CUT so the reading is the highest surface BELOW it rather than the topmost (see SurfaceSampleOptions.maxHeightM — this is what lets a walker read the floor of an interior instead of the roof over it).

      Returns (number | null)[]

      Height in metres above the rendered ground datum per point, or null where this layer has no surface.

    • Highlight one feature — the building the user clicked.

      Parameters

      • value: string | number | null

        The key value to select, or null to clear. Pass a picked feature's objectId straight through.

      Returns Promise<void>

      Resolves once every resident tile has been re-styled.

      Keyed on I3sMeshLayerOptions.selectionField (the OBJECTID by default) rather than on the picked feature ordinal, so the highlight follows the building through LOD changes instead of jumping to whichever feature happens to hold that ordinal in the next tile.

      The highlight overrides any symbology colour, and never resurrects a feature the filter excluded.

      map.on('click', async (e) => {
      const hit = await layer.pickFeature(e.point.x, e.point.y);
      await layer.select(hit?.objectId ?? null);
      });
    • Toggle the DEBUG tile bounding-volume (OBB) wireframe overlay live (placement QA).

      Parameters

      • on: boolean

      Returns void

    • Resize the resident-memory budget live (the runtime equivalent of the budget ctor option).

      Parameters

      • opts: { maxBytes?: number }

        maxBytes = resident VRAM budget in bytes. Shrinking evicts far/out-of-view tiles on the next frame; growing lets the far LOD refill.

      Returns void

    • Restyle the hard-edge overlay, or turn it off.

      Parameters

      Returns void

      Colour, width, opacity and overshoot are uniforms, so this is instant and costs no re-decode. creaseAngle and maxEdgesPerTile are NOT re-read here: they decide what geometry gets extracted, which happened when each tile decoded. Change those in the constructor.

      Passing null stops drawing edges. It does not reclaim the extracted line geometry — the tiles keep it so turning edges back on is instant.

      This only ever draws what was extracted, so it has no effect on a layer constructed without I3sMeshLayerOptions.edges.

      layer.setEdges({ color: [0, 0, 0], width: 1.5, overshoot: 2 });
      layer.setEdges(null);
    • Show only the features matching a SQL expression over the service's attributes.

      Parameters

      • expr: string | null

        The expression, or null/'' to clear it.

      • Optionalopts: { mode?: FilterMode }
        • Optionalmode?: FilterMode

          'hide' removes non-matching features; 'xray' dims them so the surrounding context stays legible. Default 'hide'.

      Returns Promise<void>

      Resolves once every resident tile has been re-styled.

      The same shape as Esri's definitionExpression, e.g. "Type_Toit = 'plat' AND H_MAX <= 20". Composes with I3sMeshLayer.setSymbology: the filter decides WHICH features are visible, the symbology decides what the visible ones look like.

      Only the columns the expression references are fetched, per node, and cached — so a filter over one field never downloads the rest of the attribute table.

      await layer.setFilter("Type_Toit = 'plat' AND H_MAX <= 20");
      await layer.setFilter('H_MAX > 50', { mode: 'xray' });
      await layer.setFilter(null); // clear
    • Fade the mesh over the basemap.

      Parameters

      • opacity: number

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

      Returns void

    • Restyle the selection — fill colour and strength, halo colour, width and opacity.

      Parameters

      Returns Promise<void>

      Resolves once the resident tiles have been re-styled.

      Applies to whatever is already selected, so a colour picker can drive it live. Merges into the current settings rather than replacing them, so changing one field leaves the rest alone.

      layer.setSelectionStyle({ haloColor: [1, 0.4, 0], haloWidth: 12, fillStrength: 0.2 });
      layer.setSelectionStyle({ haloWidth: 0 }); // fill only
    • Toggle cast shadows at runtime (the setShadows half of SunLightable).

      Parameters

      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

    • Light this layer from a SunState — satisfies @bitruvius/sdk-maplibre's SunLightable, so a GeoSunSystem / RendererSunController drives it directly.

      Parameters

      Returns void

    • Colour features by one of the service's published attributes.

      Parameters

      • spec: I3sSymbology | null

        The symbology, or null to clear it and return every feature to its own colour.

      Returns Promise<void>

      Resolves once every resident tile has been re-styled.

      Applies to every resident tile immediately and to each new tile as it streams, so panning into fresh nodes does not reveal unstyled buildings.

      Only the referenced column is fetched, per node, and it is cached — changing colours or switching between symbologies on the same field costs no network. A city-scale service has attributes for every building, so pulling the whole table to colour by one field would be both slow and wasteful.

      await layer.setSymbology({
      type: 'uniqueValue',
      field: 'Suburb',
      values: [
      { value: 'Te Aro', color: [0.0, 0.83, 1.0] },
      { value: 'Thorndon', color: [1.0, 0.45, 0.2] },
      ],
      defaultColor: [0.35, 0.37, 0.4],
      });
    • Switch how each building seats on the terrain it's draped over (basemap datum) — 'min'/'median'/ 'max'/'average' over its footprint. Re-clamps the resident tiles off-frame (re-armed ftTick, texture kept until the new offsets land → no flash); no re-stream, no terrain re-sample cost change.

      Parameters

      • seat: TerrainSeat

      Returns void

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

      Parameters

      • visible: boolean

        true to show, false to hide.

      Returns void

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

      Returns I3sMeshEngineStats | null

      The engine's I3sMeshEngineStats (rendered / resident / loading / in-flight counts and bytes), or null until the engine is up.