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

Landmarks 3D plugin

Request Access

Important note 3D Landmarks are in Private Preview and unavailable on a Freemium or Pay As You Grow (PAYG) basis. Click the Request Access button above to contact our Sales team. With a key that lacks the access, the map draws no landmarks and the console warns, per tile, that the key needs it.

Use cases

How it works

Installation

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

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. Pitch the camera. From above, the meshes look flat.
  2. Show the base map's 3D buildings, so the landmarks stand in a 3D city. Most standard styles ship the buildings3D group hidden. Leave this step out for landmarks alone.
  3. Create the plugin. Rendering starts once the map is ready, so there is nothing to await.
import { BaseMapModule } from '@tomtom-org/maps-sdk/map';
import { Landmarks3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';

await BaseMapModule.get(map, { groups: { buildings3D: { visible: true } } });
const landmarks = new Landmarks3D(map);

Usage examples

Set the look

The look of the landmarks is a set of knobs. Set the ones you want, and leave the others to the base map:

import { resetKnob, setKnob } from '@tomtom-org/maps-sdk/map';
import { landmarks3DKnobCatalogue } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';

landmarks.updateConfig({ color: '#c8b28a', opacity: 0.9 });               // the rest still follows the base map
setKnob(landmarks, landmarks3DKnobCatalogue, 'verticalGradient', false); // a value held as data
resetKnob(landmarks, landmarks3DKnobCatalogue, 'color');                 // back to the base map's colour
landmarks.resetConfig();                                                 // every knob back to the base map

Knobs

Knob Values Unset
visible true or false true
color a CSS colour the colour of the base map's 3D buildings
opacity 0 to 1 the opacity of the base map's 3D buildings
verticalGradient true or false: whether the walls darken towards the ground as the base map's 3D buildings
minZoom, maxZoom 0 to 22: the lowest and highest whole zoom levels the landmarks are drawn at the zoom range of the base map's 3D buildings

Terrain

Landmarks stand on 3D terrain without any configuration. The plugin lowers each one onto the lowest ground under its footprint, so no wall floats above a slope. Landmarks follow the terrain as it loads or its exaggeration changes.

import { TerrainModule } from '@tomtom-org/maps-sdk/map';
import { Landmarks3D } from '@tomtom-org/maps-sdk-plugin-landmarks-3d';

await TerrainModule.get(map, { elevation: { visible: true }, hillshade: { visible: true } });
const landmarks = new Landmarks3D(map);

Toggle visibility

landmarks.setVisible(false); // the same as landmarks.updateConfig({ visible: false })
landmarks.isVisible(); // false

Several maps

Create one Landmarks3D per map. Each one loads the tiles of its own map's view:

const landmarks = maps.map((map) => new Landmarks3D(map));

To frame a tall landmark, aim the camera at its mid-height instead of its foot. Set centerClampedToGround: false on the map and give the camera an elevation in metres. MapLibre's flyTo and easeTo leave the elevation where it was, so move with jumpTo:

const map = new TomTomMap({
    mapLibre: {
        container: 'map',
        centerClampedToGround: false,
        center: [2.2945, 48.8584],
        elevation: 165, // halfway up the Eiffel Tower
        zoom: 15.4,
        pitch: 60,
    },
});
new Landmarks3D(map);

map.mapLibreMap.jumpTo({ center: [-122.3493, 47.6205], elevation: 92 }); // on to the Space Needle

The demo below shows four landmarks of one kind, one per map:

Configuration

Pass the knobs to start with in the constructor, alongside withCredentials. That option sends cookies with each tile request, and follows the SDK's proxy configuration unless you set it.

const landmarks = new Landmarks3D(map, { minZoom: 14, opacity: 1 });

Landmark tiles exist at zoom 15 only. Below it, each view needs more of them: at zoom 13, 16 times as many, and more again on a pitched map. Keep minZoom close to 15, above all with several maps on a page.

API reference

For complete documentation see the Landmarks3D API Reference.

Related guides and examples