cesium-mapterhorn-provider is a small open-source terrain provider that lets CesiumJS use Mapterhorn as a terrain source. Mapterhorn serves global elevation data as Terrarium-encoded 512 px WebP tiles in the XYZ / Web Mercator scheme, so it works without a Cesium ion token or a custom tile server.
- Live demo: Cesium + Mapterhorn terrain (3D view of the Matterhorn with aerial imagery, a terrain exaggeration slider, and a field to change the tile URL)
- Source: GitHub - bertt/cesium-mapterhorn-provider: CesiumJS terrain provider for Mapterhorn (Terrarium-encoded WebP) tiles · GitHub
- npm: https://www.npmjs.com/package/@bertt/cesium-mapterhorn-provider
Features
- Configurable tile URL template (default
https://tiles.mapterhorn.com/{z}/{x}/{y}.webp), so you can point it at your own mirror - Decodes Terrarium heights (
R * 256 + G + B / 256 - 32768) and resamples each tile to a configurable heightmap grid - Available as an ES module and as a browser global build for use with a script tag
- Tested against CesiumJS 1.146
Quick start
import { Viewer } from "cesium";
import { MapterhornTerrainProvider } from "@bertt/cesium-mapterhorn-provider";
const viewer = new Viewer("cesiumContainer", {
terrainProvider: new MapterhornTerrainProvider({
url: "https://tiles.mapterhorn.com/{z}/{x}/{y}.webp",
}),
});
Status
This is an early 0.1.0 release. The provider generates heightmap terrain only, with no vertex normals or water mask, and the maximum zoom level is assumed to be 17. Feedback, issues and pull requests are welcome.
