Receiving elevation data through Cesium

I've noticed that when trying to acquire elevation data through Cesium that the numbers are not accurate when zoomed out. I noticed this when trying to create a lat/lon/elevation readout. Some of the elevation values were in the negative thousands, but resolved as I zoomed in.

The method I'm using to acquire elevation is
viewer.scene.globe.getHeight( cartographic )



This is because value of getHeight will change depending on the current level of detail needed for the globe terrain based on the camera distance.

For consistent results, you can use the sampleTerrain function. You specify the terrain provider, the level of detail at which to query, and an array of cartographic positions. It will return a promise to an array of cartographic with a height.

You can see an example of how to use this function in the Terrain Demo. Scroll to where it says “Sample Everest Terrain”.



Thanks, that fixed it.

Another question. Is there a way to get Cesium to calculate elevation in terms of mean sea level rather than height above WGS84 ellipsoid?

Not yet, but it is on the roadmap.

Cesium assumes this height is meters above the WGS84 ellipsoid.

So what height does Cesium's heightmap format represent? The spec for Heighmap just says elevation is in meters.