Rookie question regarding KML and altitudes

Hi folks, and wow Cesium looks incredible.

I am just starting out and am looking at the Sandcastle project, specifically the KML showcase and the bike ride.

I note that the KML defines the altitude for each point on the trail so I assumed that would be used when showing the track in the viewer, however I experimented with changing the altitudes in the KML file and the track stays on the ground.

Am I doing something wrong? I fully expect to be misunderstanding something, if anyone can be bothered giving me a nudge in the right direction I’d appreciate it.



KML has a notion of altitudeMode which defaults to clampToGround, which means all heights are ignored and the track should always be on the ground. If you add an altitudeMode of absolute to the bike ride, it will do what you want. The actually available altitudeMode options can vary slightly from track to track, in this case the bike ride is a gx:Track. See this link for details:

Cesium parses are reads all altitudeMode settings, but we don’t match Google Earth in terms of results yet. For example, clampToGround clamps to the the ellipsoid and not the terrain while “absolute” provides height above ellipsoid instead of height above MSL. We plan on addressing all altitudeMode issues in a near term release.

Thanks Matthew. I looked at the altitudeMode and it is set to absolute, which is why I was confused.


and here is an example coordinate showing the altitude value:

gx:coord-75.300238 40.109584 1002</gx:coord>

The good news is that by opening it in Google Earth and fiddling with it I managed to make it work.

Google Earth added a second altitudeMode node under the gx:Track node. I suspect that is what fixed it.





Note that even in GoogleEarth this doesn’t seem to behave as expected - “absolute” seems to ignore the altitudes in the gx:coord nodes unless the text box next to the absolute setting says “various altitudes (min=-37m, max=1041m)”. Not sure what that’s about.

Perhaps it’s worth updating the example, if the above is indeed a fix for the altitude being ignored?


I was having the exact same issue as you, Guy. Even in the sandcastle example, the elevation is locked to the ellipsoid rather than terrain (even though altitude is included).

Thank you so much for adding to put <altitudeMode> in a second time. I was about to translate my .kml file to .czml and was not looking forward to the amount of time it would take me. Adding that in got my elevation working perfectly.