SDK JS
    Preparing search index...

    A SunConsumer that grades the map SURFACE — the basemap and, because MapLibre drapes 2D layers onto the terrain mesh, the terrain with it.

    BasemapController drives raster-brightness-max on ONE raster layer. That covers a satellite basemap and nothing else: a vector style is dozens of fill/line/symbol layers with no brightness property between them, and MapLibre has no global tint. So on a vector style — which is most styles, including the one in our own sun-control example — the ground stayed at full daylight while the buildings darkened, and under 3D terrain that reads as "the terrain ignores the time of day".

    This takes the one approach that works for any style: a world-covering fill whose opacity follows the sun, inserted BELOW the first symbol layer so labels stay legible, and above everything else so it tints what is underneath. It is part of the draped set, so the terrain surface darkens with the flat map rather than staying lit on its own.

    Additive to BasemapController rather than a replacement — on a raster basemap, grading the imagery itself is the better-looking result, and both can run.

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

    // The one-call route is setTimeOfDay({ map, gradeGround: true }); by hand:
    map.on('load', () => {
    const system = new GeoSunSystem(map, { controllers: [new GroundGradeController(map)] });
    system.update(new Date()); // inserts the overlay and sets its tint
    // system.dispose() removes the overlay layer + source
    });

    Implements

    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • map: Map$1

        The MapLibre map to drive.

      • idPrefix: string = 'bitruvius-ground-grade'

        Prefix for the source/layer this controller owns. Default bitruvius-ground-grade.

      Returns GroundGradeController

    Methods

    • Remove the overlay source + layer (best-effort; no-op if the style is gone).

      Returns void