SDK JS
    Preparing search index...

    A SunConsumer that drives MapLibre's global style light (map.setLight) from the sun. This only affects fill-extrusion layers and casts no real shadows — it is the "visual sync" so the basemap's 3D buildings agree with the renderer's sun. The light azimuth is map-anchored (geographic), so it matches the sun's compass bearing directly.

    Created for you by setTimeOfDay; construct one directly only when wiring a GeoSunSystem by hand.

    import { GeoSunSystem, MapLibreLightController } from '@bitruvius/sdk-maplibre';

    // After `load` — setLight throws while the style is not ready.
    map.on('load', () => {
    const system = new GeoSunSystem(map, { controllers: [new MapLibreLightController(map)] });
    system.update(new Date()); // the extrusions light from this instant's sun
    });

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Apply the sun to map.setLight, mapping SunState.azimuthDeg to the light's geographic azimuth and clamping a below-horizon sun to the horizon.

      Parameters

      Returns void

      Propagates from map.setLight if the map's style is not ready — call after the map's load event (the setTimeOfDay facade wires this for you).