Clamping polyline to ground isn't really working

Currently on Cesium 1.20

Most of my visualizations are on water, nice flat surface, so you would think that they would render out fine clamped to ground.

However, a lot of the time, my polylines are rendering below the surface of the water, which leads to the lines moving around when the view is rotated. (See for a good example.)

Is there a way to get the lines to always render on the surface of the water? (Here’s an example of one that is working well. you may need to move the time slider to reveal the whole track.)

Ideally I’d still like to have some sense of the surrounding topography.

Here’s how I declare a typical provider view model:

var providerViewModels = ;

providerViewModels.push(new Cesium.ProviderViewModel({

name: ‘Bing Maps Aerial’,

iconUrl: Cesium.buildModuleUrl(‘Widgets/Images/ImageryProviders/bingAerial.png’),

tooltip: ‘Bing Maps aerial imagery \n’,

creationFunction: function () {

return new Cesium.BingMapsImageryProvider({

url: ‘//’,

mapStyle: Cesium.BingMapsStyle.AERIAL




When I declare the terrainProvider and load the datasource, it’s done with this (note clampToGround):

var terrainProvider = new Cesium.CesiumTerrainProvider({

url: ‘//’,

requestWaterMask: false


viewer.terrainProvider = terrainProvider;

viewer.dataSources.add(datasource.load(’<% =KmlUrl() %>’, {clampToGround: true})).then(function(datasource) {


I’ve tried out versions 1.21 through to 1.27 to see if they improve any of this.

Versions 1.21 and 1.22 don’t appear to change the behaviour, and they seem to work fine.

Versions 1.23 and 1.24 both generated rendering errors in my site, so they won’t work.

Versions 1.25 through to 1.27 change the behaviour somewhat. The highlight segments of my tracks (in a different color) are now rendered clamped to the ground, as is the placemark icon. The track polyline, though, is still underground, also the flyTo command now doesn’t flyTo the track location, but some distance away. So these versions are no good either.

I’ve upgraded to 1.22 now since that seems stable and hasn’t broken anything.

Hi Dylan, Would you be able to attach one of the KML files so we can test to see what isn’t working?