KML Clamp to ground

I know this is an often-asked-for feature, but every post that I can find is 2+ years old, so I'm hoping for some newer information. I'm trying to get some simple KML to display clamped to the ground, using the dragDropMixin. However, the polygons clip with the terrain, and the more I zoom in the worse it gets. Is there support for getting these polygons to properly drape over the terrain? Or does anyone know some alternatives that I can use to get a similar effect? (I have some control over the KML that will be used).

Here's how I set up the viewer:

var viewer = new Cesium.Viewer(‘cesiumContainer’);
var dragDropOptions = {
  clearOnDrop : true,
  flyToOnDrop : true,
  clampToGround : true
             viewer.extend(Cesium.viewerDragDropMixin, dragDropOptions);
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
  url : ‘’,
  requestVertexNormals : true


Here is the KML:
    <kml xmlns="">
        <name>The Empty Box</name>


And here is an example of what it looks like:

Your coordinates cannot include a Z. You need X-Y coordinate pairs for clampTo Ground to work. Not even a zero, no Z. Your example shows X-Y-Z coordinates. I share your pain, but at least you have control iver the KML, and it's worth the effort to strip out those Z values. You must download the April update being released 4/03! There is an issue being fixed that affects polygons clamped-to-ground when viewed in 2D. But the current release is fine for 3D view.

I tried removing the Z coordinates from the KML, but the behavior didn’t change.

Okay, Nick,
I may have steered you in the wrong direction.

First, if you are using a drag&drop mixin, you’re probably going to need help from another user, or someone on the Cesium team.

I add my KML programatically. My KML is a GPS track,

Also, re-examining my KML files, I did not remove the Z coordinates.

a snippet of my KML:






a snippet of my code:

//declared variable at module level: var userKmlFile = wp_plugin_url.concat(“lftgly/datasources/kml/Ski recon.kmz”);

userKmlDataSource = new Cesium.KmlDataSource(“UserKmlData”); //declared variable at module level: var userKmlDataSource;

var options = {camera :, canvas : CesiumMapViewer.scene.canvas, clampToGround : true};

CesiumMapViewer.dataSources.add(userKmlDataSource.load(urlUserKmlFile, options)).then(function(dataSource){

CesiumMapViewer.clock.shouldAnimate = false;

var hiker = dataSource.entities.getById(‘tour’); //"tour’ is the ‘id’ element in the KML, “track” is the ‘name’ element of the same placemark

if (hiker != undefined){


CesiumMapViewer.clock.multiplier = 10;

CesiumMapViewer.clock.shouldAnimate = true;			  

}); //end flyTo.then function


}); //end load.then function

Removing the Z coordinates was required in my GeoJSON data files for GeoJsonDataSource,

a snippet of my code:

AvalanchePathPolygonsDataSource = new Cesium.GeoJsonDataSource(“AvalanchePathPolygons”);


return AvalanchePathPolygonsDataSource.load(jsonFeatureCollection,{clampToGround: true});

I apologize, these two different Cesium datasources behave very differently, thanks for making me review my own code, and good luck to you.