SDK JS
    Preparing search index...

    An embeddable, framework-agnostic MapLibre elevation-profile control (a maplibregl.IControl): draw a line on the map (double-click / Enter to finish) and the widget samples the MapLibre terrain along it (queryTerrainElevation) into an inline SVG elevation-vs-distance chart with min / max / gain / loss stats. Hover is synced BOTH ways — moving over the chart drives a crosshair and a marker on the map at that station; moving along the drawn line on the map drives the chart crosshair.

    Stations sampled before their DEM tile streamed re-sample automatically on the map's next 'idle' (bounded, convergence-gated). With MapLibre terrain disabled the profile is flat zero and the panel says so. On every change the widget dispatches CustomEvent('profilechange', { detail: ProfileRun | null, bubbles: true }), and 'profilehover' with the hovered station (or null).

    import { ElevationProfileWidget } from '@bitruvius/sdk-maplibre';
    map.addControl(new ElevationProfileWidget(), 'top-right');

    ElevationProfileWidgetOptions for the configuration fields.

    Implements

    • IControl
    Index

    Constructors

    Accessors

    • get profile(): ProfileRun | null

      The latest sampled run, or null (programmatic access).

      Returns ProfileRun | null

    Methods

    • Default control position.

      Returns ControlPosition

    • MapLibre IControl hook — builds the DOM and wires the controller.

      Parameters

      • map: Map$1

      Returns HTMLElement

    • MapLibre IControl hook — full teardown.

      Returns void

    • Fold the panel to its round FAB, or expand it back.

      Parameters

      • collapsed: boolean

        true to fold to the FAB, false to expand.

      Returns void

      Safe to call before map.addControl — the state is remembered and applied when the DOM is built, matching the other widgets.