TomTom Maps for JavaScript
    Preparing search index...

    Function getMapLight

    • Gets where the map's light comes from right now, so a layer drawing its own lit surfaces can share it. A light aligned with the viewport turns with the map, so read it again after the camera moves.

      Parameters

      Returns MapLight | undefined

      The light's direction and altitude, or undefined while the map has no light placed, or places it with an expression, such as one that moves it with the zoom, that no one direction stands for. The plugins then light their surfaces from their presets.

      The standard styles place no light of their own, so this returns undefined until one is set, through the styling module's view.light.direction or view.light.altitude knob, MapLibre's setLight, or a style that declares a light. The 3D buildings and the textured surfaces of the landmarks-3d plugin follow it while their own light knobs are unset.

      await StylingFoundationsModule.get(map, { view: { light: { direction: 250, altitude: 20 } } });
      const light = getMapLight(map); // { direction: 250, altitude: 20 } at bearing 0