fromWorldTerrain

Creates a Terrain instance for Cesium World Terrain.

// Create Cesium World Terrain with default settings
const viewer = new Viewer("cesiumContainer", {
terrain: fromWorldTerrain()
});
// Create Cesium World Terrain with water and normals.
const viewer1 = new Viewer("cesiumContainer", {
terrain: fromWorldTerrain({
requestWaterMask: true,
requestVertexNormals: true
});
});
// Handle loading events
const terrain = Terrain.fromWorldTerrain();

scene.setTerrain(terrain);

terrain.readyEvent.addEventListener(provider => {
scene.globe.enableLighting = true;

terrain.provider.errorEvent.addEventListener(error => {
alert(`Encountered an error while loading terrain tiles! ${error}`);
});
});

terrain.errorEvent.addEventListener(error => {
alert(`Encountered an error while creating terrain! ${error}`);
});

Return

An asynchronous helper object for a CesiumTerrainProvider

See also