Terrain Exaggeration Issue

1. A concise explanation of the problem you're experiencing.
I am using global DEM from USGS. I have a globe setup and terrain exaggeration is "working". I am placing pins on the map using actual elevations from USGS.

If i set the terrain exaggeration value to 0[Flat Map] and offset the elevation so it is exactly 0, my pins lay directly on the surface like they should. The problem is that negative elevations are inside the planet. With exaggeration of 0[Flat Map] this is expected. When i set terrain exaggeration to 1 the terrain is exaggerated. The point is now inside the planet. The point is at 0 elevation which is actually about 4km above the surface due to this point being 4km below "sea level".

How does cesium compute terrain exaggeration. Do it read elevation data from the DEM?

4. The Cesium version you're using, your operating system and browser.
Cesium Version: 1.24
OS: Ubuntu 16.04 & OSX High Sierra
Web Browsers: Chrome(Current Stable), FireFox(Current Stable), and Safari.

Hi there,

Here’s the code changes where terrain exaggeration was implemented. It’s based on the height of the provided quantizedMesh or heightmap provided. If you could provide a Sandcastle example showing the problem, we can take a look and see if there is a potential error with how we are handling points in the case of terrain exaggeration.



Sorry it took so long to respond. I don’t have a sandcastle example as I am not working inside sandcastle. I do have screen shots and a screen capture video showing what happens if that is helpful to you.

Here is a google drive share that shows the problem with screen shots and screen capture video. In the video I have debug console showing. This shows the actual elevation of the point I clicked on the map. I place the pin 5000 meters above the point clicked. So the point i clicked is approximately -4100 meters and i place the pin at 5000 meters above that. So my pin is actually about 900 meters above sea level on this video. As you will see the pin gets absorbed inside the planet when terrain exaggeration is turned on. This is the source data used for basemap https://astrogeology.usgs.gov/search/details/Mars/Viking/MDIM21/Mars_Viking_MDIM21_ClrMosaic_global_232m/cub.

I am also curious as to what projection system Cesium expects in it’s DEM’s?

Google Drive Share: https://drive.google.com/open?id=1poLxN8UCdGrXLS8FZRwHKt5M0i1UcFj2

Thank you

Hi Chris,

The Sandcastle example isn’t as necessary as a code snippet, I just need to see how you are adding your pins so we can figure out what exactly what’s going on here.

Cesium doesn’t use the DEM files directly, they must be converted to heightmap or quantized-mesh formats: https://cesiumjs.org/data-and-assets/terrain/formats/



Ok. Here is a code snippet of adding a pin to the map.
entity = kernel.cesiumWidgetObj.entities.add({

id: pointdata.counter.toFixed(0),

name : ‘Pin’,

position : Cartesian3.fromDegrees(pointdata.lon, pointdata.lat, pointdata.s_alt),

billboard : {

image : this.SELECTED_PIN,

verticalOrigin : Cesium.VerticalOrigin.TOP



pointdata is a data structure containing the information for a given point. lon and lat are obviously latitude and longitude location of the point. s_alt is the elevation of the point + 5000 meters. The elevation of the point is gathered from a rest api call that gets the scientifically accurate elevation of that lat/lon position.

Here is a definition of the data structure holding all the information:

var pointdata = {

pid: counter,

lon: lon,

lat: lat,

s_alt: altitude + 5000,

heading: heading,

pitch: pitch,

roll: roll,


Thank you for your help. I appreciate it.

I'm just checking in. Any thoughts on this? Am I doing something incorrectly?

Hi Chris,

Apologies for the delay! Is there a particular reason you are using the predetermined s_alt value? If not, I would recommend setting the Billboard.heightReference property to HeightReference.CLAMP_TO_GROUND. It will clamp the billboard to terrain without having to sample the height value yourself. Let me know if that doesn’t work for your purposes.



Thank you for that. I must have missing the CLAMP_TO_GROUND property in the documentation. I will give that a try and see how it works out.

So my pins are now working properly. I needed the RELATIVE_TO_GROUND property. This allowed my altitude of the pin to float in space above the ground as I wanted it.

Is there a way for me to do this with a poly line as well? There is a poly line arrow that connects each of those pins together. They are still being set below the surface and I need those to be “attached" to the bottom of the pins.

Thank you

Awesome, glad that works!

Polylines cannot yet be draped on terrain, but we are currently working on supporting that feature. Keep an eye on #2172 in GitHub.

Awesome. Thank you for your help.