This is the documentation of version 1.0.0-rc.0. Go to the latest version, 1.0.0-rc.5.

Globe and sky

The Styling Foundations module's view knobs hold the projection and sky, the map-level MapLibre state that a style switch would otherwise reset. So a globe stays a globe across setStyle. Like any other knobs, they work with setKnob, getKnob, resetKnob and getConfig(), on every style.

Projection and sky

import { setKnob, StylingFoundationsModule, stylingFoundationsKnobCatalogue } from '@tomtom-org/maps-sdk/map';

const styling = await StylingFoundationsModule.get(map);
setKnob(styling, stylingFoundationsKnobCatalogue, 'view.projection', 'globe');
setKnob(styling, stylingFoundationsKnobCatalogue, 'view.sky.visible', true); // without it, a globe has no atmosphere

Sky colours

view.sky.color and view.sky.horizonColor colour the sky. If you don't set them, they take:

The colour behind the map

view.space.color is the colour behind the map. It shows around the planet on a globe, where the map canvas is transparent.

setKnob(styling, stylingFoundationsKnobCatalogue, 'view.space.color', '#05070d');

What to expect

The demo above zooms a globe into 3D terrain. The 3D terrain playground keeps a tilted camera, its sky and its relief across a style switch. The map effects plugin's depth of field keeps one distance of a tilted view sharp and blurs the rest.

Related guides and examples

Related guides

Related examples