Skip to content

50,000 free calls a month, card-free. Get an API key →

Documentation menu
docs / examples / 3d-terrain
Example

3D terrain

One flag drapes the map over real elevation and shades the relief. The default DEM is the same dataset the gateway samples for POST /elevation, so a rendered mountain and a queried one agree.

ts
import { createMap } from "@mapmap/maps";

const map = createMap({
  container: "map",
  apiKey: "snk_...",
  attributionPosition: "bottom-left",
  center: [-3.21, 54.45],
  zoom: 11,
  terrain: { exaggeration: 1.4, hillshade: true },
  mapOptions: { pitch: 60 },   // tilt, or the relief reads flat
});

// terrain: true takes the defaults. Off again at runtime:
map.setTerrain(false);

// Terrain does not survive a style swap; the SDK re-applies it on every
// style load, so switching theme just works.