How to turn on the globe projection

This example shows how to turn on the globe projection. Creating a 3D globe view of your map requires only a single line of code. Simply include the projection option within the map constructor, specifying the globe projection.

The choice between Mercator and Globe can be done at different levels and moments in the lifecycle of the map, yet, unless stated otherwise, Mercator remains the default.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, 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:  MapStyle.SATELLITE,
  center: [-70.8, 0], // starting position [lng, lat]
  zoom: 1, // starting zoom
  projection: 'globe' //enable globe projection
});
Projection control how to toggle the map between mercator and globe projection

Projection control (globe)

Tutorials

Toggle between Mercator and globe projections using map controls.

How to switch map projection programmatically

Switch between “mercator” and “globe”

Examples

Programmatically switch between Mercator and globe map projections.

Create a globe map with ocean bathymetry terrain elevation

Globe with ocean bathymetry

Examples

Display ocean bathymetry and terrain elevation on 3D globe.

Display a 3D terrain map

3D terrain map

Tutorials

Create and display 3D terrain maps on web pages.

Was this helpful?