Problem rendering KML file with 3D terrain

Hello cesium users,
I use cesium js for my website in order to display KML routes on the 3D terrain.
The display of the KML file works pretty well but it seems to have a strange behaviour when moving into the scene or use the zoom.
The KML route seems to be unbound from the terrain and move separately of the terrain.
I can’t find the origin of the problem.
Could you help me ?

Another question : is there any possibility to display directly GPX file with cesium ? I would like to avoid using KML files.

Thank you very much for you help.



Hey Jerome, welcome back to the Cesium forum!

Your KML is not clamped to ground. Make sure you pass the clampToGround option when loading it (see

For supporting GPX directly - this is something I’d like to see in CesiumJS too. It looks like there was already work done on this that was almost complete but never finished:

If you have a chance to test that branch we’d be happy to review a pull request. It might just be a matter of updating it to the latest version and adding tests/documentation.

Hi Omar;
Thank you very much for your answer.
Unfortunately, the clampToGround option don’t seem to correct the problem :frowning:
In fact point are correctly clamped to the ground but the polyline is not.
Anything i didn’t do correctly ?
Thank you for the gpx implementation. I also use the leaflet-gpx plug in and it works fine. I will have a look at the gpx branch later.


The other requirement for lines to be clamped to ground when loading from KML is to have the tesselate property be true, and the altitude mode to be set to clamp to ground:

Hi Omar !!!
It works fine !!!
Many thanks for your help !!!
I had looking for a solution to this problem for many months and i would have not find it without you !!
Great job !
Have a nice day.


Glad that resolved it! We did add a warning for this in the latest CesiumJS version so it’s more clear what’s happening:

I also opened this issue to consider not having tesselation be a requirement: