Skip to content
Make with

Mapterhorn Terrain

by MapterhornFree, no API key

Open elevation tiles in Terrarium format: 30 m worldwide and 1 m or finer where countries publish lidar data. Free with no API key; credit Mapterhorn and its sources. Use for hillshading and 3D terrain in MapLibre.

const elevation = {
  type: "raster-dem",
  tiles: ["https://tiles.mapterhorn.com/{z}/{x}/{y}.webp"],
  tileSize: 512,
  encoding: "terrarium",
  attribution: "<a href=\"https://mapterhorn.com/attribution\">© Mapterhorn</a>",
};

const map = new maplibregl.Map({
  container: "map",
  style: {
    version: 8,
    sources: {
      terrain: elevation,
      hillshade: elevation,
    },
    layers: [
      { id: "background", type: "background", paint: { "background-color": "#e9e5dc" } },
      { id: "hillshade", type: "hillshade", source: "hillshade" },
    ],
    // Enable 3D terrain from the elevation source
    terrain: { source: "terrain", exaggeration: 1.5 },
  },
});