/cesium-martini

Create cesium terrain from raster tile,从栅格瓦片创建cesium地形

Primary LanguageTypeScriptMIT LicenseMIT

Cesium-Martini

This is a fork from cesium-martini, click to view details.

This module can create cesium terrain through raster tile service.

Cesium-Martini

Usage

import { Viewer, Resource } from "cesium";
import { MartiniTerrainProvider } from "@zjugis/cesium-martini";

const cesiumViewer = new Viewer("cesiumContainer");

const terrainLayer = new MartiniTerrainProvider({
  url: new Resource({
    url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}@2x.webp',
    queryParameters: {
      access_token: 'pk.eyJ1Ijoic3ZjLW9rdGEtbWFwYm94LXN0YWZmLWFjY2VzcyIsImEiOiJjbG5sMnFlZ28wb2d5MnFtb2xnMG90OW96In0.IE8Vqs0NTzCY0WqPzV9kcw'
    },
  }),
  requestVertexNormals: true,
});

cesiumViewer.scene.terrainProvider = terrainLayer;

Installation

This package is listed on NPM as @zjugis/cesium-martini. It can be installed using the command

npm install --save @zjugis/cesium-martini

Demo

online Demo

Launch the app in the demo folder, and then visit http://localhost:5173/

Cesium-Martini

pnpm install
pnpm dev

Credit

https://github.com/davenquinn/cesium-martini