Create a globe map with 3D terrain elevation
Show a detailed 3D (three-dimensional) globe map with terrain elevation. Creating a 3D terrain globe view of your map requires only two lines of code. Simply include the projection and the terrain option within the map constructor.
Enhance the authenticity of your web mapping applications and data by using the globe projection and incorporating terrain relief into your maps. This will provide a greater sense of realism and depth to your visuals.
NPM module setup
npm install --save @maptiler/sdk
import { Map, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';
config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
container: 'map', // container's id or the HTML element to render the map
style: 'ocean',
maxPitch: 85,
center: [-115.54098, 51.2018],
zoom: 14,
pitch: 83,
bearing: 37.1,
projection: 'globe', //enable globe projection
terrain: true, //add terrain elevation
terrainExageration: 1.5
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title>Create a globe map with 3D terrain elevation | NPM example</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div id="map"></div>
<script type="module" src="./main.js"></script>
</body>
</html>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
Related examples
Projection control (globe)
TutorialsToggle between Mercator and globe projections using map controls.
Animate a 3D plane flight in a globe
ExamplesAnimate airplane flight paths using 3D models on globe.