Globe#getHeight returning erratic negative values

Hi, I’m trying to use Globe#getHeight to get the values of the terrain height at a certain point which matches what is shown on the globe. Given the documentation, I was expecting that this would match my needs perfectly, however, it seems that it seems to return oddly negative values (e.g. -28760m over land) at times. Guessing that this was a problem with the terrain provider, I swapped it out for Cesium’s basic EllipsoidTerrainProvider, which as far as I am aware simply models a height of 0 across the entire Earth.

However, when I performed testing with this using the simple “Hello World” application, depending on where and how much the Earth was zoomed into, the values returned were either very negative (e.g. -8000m, -27840.7m), just below zero (much closer to what I would expect) or “undefined” (presumably because the area concerned was out of view). This “very negative” result seems to be causing issues with the application that I’ve been trying to work with, but I’m not sure whether this is by design or a bug.

Also, is there any way of finding out what the level of terrain loaded is at a given point? This would be useful to implement so that we can use “sampleTerrain” if the level is too low (but otherwise match what is shown on the globe).

Hi,

As you noted, getHeight uses the current terrain level of detail so when the viewer is zoomed way out, the numbers can be negative since the triangle for the terrain is actually under the ellipsoid. You can use sampleTerrain for a more precise answer. Cesium doesn’t report the current terrain LOD. As a workaround, you may be able to pick getHeight or sampleTerrain based on the distance to the ellipsoid (see pickEllipsoid).

Patrick