I am getting negative elevation values from CesiumTerrainProvider (stk-terrain). For few locations the below code is giving negative elevation values, which are wrong, as I have checked those values from other sources.
Is there any problem with the terrain provider or my code.
Here is my code -
var viewer = new Cesium.Viewer('cesiumContainer');
var terrainProvider = new Cesium.CesiumTerrainProvider({
url : '//cesiumjs.org/stk-terrain/world'
});
var positions = [
Cesium.Cartographic.fromDegrees(77.01091072384598, 8.656004976829797),
];
var promise = Cesium.sampleTerrain(terrainProvider, 11, positions);
Cesium.when(promise, function(updatedPositions) {
console.log(positions[0].height);
});
// Fly to a position
viewer.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(77.01091072384598, 8.656004976829797)
});
The elevations sampled in cesium are relative to the wgs84 ellipsoid. Could your comparison data be relative to mean sea level?
Alex
Here’s a bit more background on the discrepancies between mean sea level elevation and heights above the WGS84 ellipsoid. Is your comparison elevation data closer to 100m?
Have a look at this geoid online calculator with your location: http://geographiclib.sourceforge.net/cgi-bin/GeoidEval?input=8.656004976829797%2C+77.01091072384598&option=Submit
The geoid height is 96m BELOW the WGS84 ellipsoid. EGM96 = -96.9038
When I compare against BING Elevation Services, I’m seeing similar results. An elevation of 4m relative to the ellipsoid, and 100m relative to mean sea level.
Thanks for the reply ! I think I got my answer , I was confused with mean sea level and ellipsoid level.
Using the OPs example, I get a computed height of 7.526987031130723.
Using Cesium.Cartographic.fromDegrees(-105, 36), I get a computed height of 2134.9071706146633, but http://geographiclib.sourceforge.net/cgi-bin/GeoidEval?input=36+-105&option=Submit gives -18.6719 for EGM96.
So I'm a bit confused about how the numbers relate to each other.
Cesium heights are relative to a perfect ellipsoid surface. Geoid is a funny shape due to varying Earth surface densities that the Ocean surface generally follows (generally, currents can also affect the ocean surface heights.)
http://news.bbc.co.uk/2/hi/sci/tech/8767763.stm shows a good map of the GeoID.
Notice how the southern tip of India is -100 meters while north of Australia is +100 meters. India is pushing north against Asia at about 2 inches a year causing a mass void in it’s place. I’m not sure about north of Australia and near Greenland, my guess is that volcanic activity deposited alot of mass there. Oddly enough the Challenger deep isn’t that far from the +100 meter area.