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

Landmarks 3D plugin

The Landmarks 3D plugin turns a TomTomMap into a 3D city. Well-known buildings stand as detailed models, every other building rises with windows and shadows, and the ground takes on rippling water, fields and asphalt, with trees on its woods and parks. The example below draws all of it around the Eiffel Tower, and a slider moves the sun across the day:

The plugin has three parts. Use any one of them alone, or combine them for the whole city. Each part has its own guide:

Guide Class Draws Access
3D landmarks Landmarks3D Textured 3D models of well-known buildings, such as stadiums, cathedrals and towers Private Preview, on request
3D buildings Buildings3D The base map's buildings in 3D, with windows, lit windows at night and shadows from the sun or the moon Public Preview, any API key
GL surfaces GLSurfaces The style's water, land cover and roads as textures, with 3D trees on woods, parks and meadows Public Preview, any API key

Installation

This plugin uses @tomtom-org/maps-sdk, maplibre-gl and three as peer dependencies. Install all three, whichever parts you use.

npm install @tomtom-org/maps-sdk maplibre-gl three @tomtom-org/maps-sdk-plugin-landmarks-3d
  1. Follow the SDK Project Setup to create a TomTomMap.
  2. Pitch the camera. From straight above, a 3D city looks flat.
  3. Create the parts you want. Each one starts drawing once the map is ready, so there is nothing to await.

A whole 3D city

To draw the whole city, create the three parts, then place the map's light they share:

import { StylingFoundationsModule } from '@tomtom-org/maps-sdk/map';
import { Buildings3D, GLSurfaces, Landmarks3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';

new GLSurfaces(map);
new Buildings3D(map);
new Landmarks3D(map);
await StylingFoundationsModule.get(map, { view: { light: { direction: 240, altitude: 25, alignment: 'map' } } });

Share the map's light

The buildings, the landmarks under them and the surfaces take their sun from the map's light, which the styling module's view.light knobs set. One light for all of them lines up the tree crowns, the dunes and the glint on the water with the buildings' shadows, and the trees stand in those shadows.

Set the look with knobs

The look of each part is a set of knobs, listed in its catalogue: landmarks3DKnobCatalogue, buildings3DKnobCatalogue and glSurfacesKnobCatalogue. Each part's guide lists its knobs and what they follow while you leave them unset.

import { setKnob } from '@tomtom-org/maps-sdk/map';
import { Buildings3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';
import { buildings3DKnobCatalogue } from '@tomtom-org/maps-sdk-plugin-landmarks-3d/knobs';

const buildings = new Buildings3D(map, { facade: { pattern: 'office' } }); // the knobs to start with
buildings.updateConfig({ walls: { variation: 0.3 } });                      // the parts you name
setKnob(buildings, buildings3DKnobCatalogue, 'light.altitude', 12);        // one knob, held as data
buildings.resetConfig();                                                    // every knob unset again

Every part follows the same rules as a map module:

API reference

Related guides and examples

Related guides

Related examples