Uploading generated DEM in tiff format flattens the whole world

Good day,

I’m new to Cesium and CesiumJS. I’m currently trying to create a color coded elevation map using the height of the terrainProvider’s target point as the basis. The tiff file was converted to quantized-mesh.

When I checked the height of the terrain using terrainSampleMostDetail(), the value returned for the height is always equal to zero. I tested it for the value of the terrain for Mt. Everest (based on the terrain example in sandcastle), instead of displaying around 7000, I only get 0.

Any help is appreciated. Thanks!

Hi @eagulto,

can you please provide a sandcastle example showing your problem, or post your code here. We can’t help you wthout code or something similar, sadly.

Best, Lennart

Hello @lennart.imberg

Here’s a sample of my code for querying the height using sampleTerrainMostDetailed(). This uses the ZionNationalPark tiff file. I’m trying to query the height of the corners and center of the region where the Zion National Park is located.

Thank you for the help,


Hi @eagulto,

sampleTerrain and sampleTerrainMostDetailed demand a list of coordinates, so here is a little change to your last function:

      for (var i in testCoordinates){
        var singleitemlist = [testCoordinates[i]]
        var z = await Cesium.sampleTerrainMostDetailed(viewer.terrainProvider, singleitemlist)

As an alternative, you could get rid of the for loop and calculate the height of all coordinates combined.

Best, Lennart

1 Like

Hello @lennart.imberg ,

Thank you very much for the help. Adding the brackets works. So sorry for the noob question.