Add custom DEM to Cesium

Hello,

Right now I am using CesiumTerrainProvider for having complete earth coverage of GeoData.
But, in some area of the world, I need to use a custom DEM data, stored on a server.

I
find on internet some exemple where people use a url inside TerrainProvider and some other that create a complete terrainProvider.

I
wanted to know if there is any information (cause I can’t find exactly)
how those the url works. Do I just return my DEM inside this? do I have
to add some kind of “location logic” ? I am a bit confused

var viewer = new Cesium.Viewer(‘cesiumContainer’, {
terrainProvider : new Cesium.CesiumTerrainProvider({
url : 'blablabla:8080/myserver/mydata
})
});

``

Also, can I add multiple terrain provider ?

CesiumJS doesn’t currently have a way to add multiple terrain providers. The easiest way that I know of combining a global terrain with some local higher res terrain is with Cesium ion, which can handle fusing these datasources together.

The way it works is that it stores the difference between each layer. So for your local high res terrain, when CesiumJS (or any other client) tries to access tiles outside that region, it will request them from the base layer. You can then fuse that layer with an additional layer, and keep doing that to update local terrain areas.

Let me know if that helps!

Thanks for the reply,

Yes, Ions is always the easiest use, I probably going to use it for the global base Layer, but the client would like to also use data outside of IONS, so with a custom DEM.

Let’s say I will not use globalTerrain for that case scenarion, can I just load a DEM file from an URL? or should I create some kind of provider ?

You would need to tile your DEM into either quantized mesh (https://github.com/AnalyticalGraphicsInc/quantized-mesh) or a height map (https://github.com/AnalyticalGraphicsInc/cesium/wiki/heightmap-1.0).

Cesium ion’s tiling pipeline is also available as a command-line interface for offline/on-premise use cases (see https://cesium.com/3d-tiling-pipeline/).