kml altitude modes with terrain

The sample code below loads a KML polygon with altitude mode set to relativeToGround. The polygon renders properly without terrain, however with a terrain provider specified, the polygon appears as if drawn beneath the surface. I see similar behavior with altitude mode set to absolute. clampToGround (the default mode) works correctly.

Does Cesium support altitude modes with terrain? If not, are there any workarounds aside from perhaps sampling the terrain and updating all the polygon coordinates?


var viewer = new Cesium.Viewer('cesiumContainer');

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
    url : ‘’,
    requestWaterMask : true,
    requestVertexNormals : true
viewer.terrainProvider = cesiumTerrainProviderMeshes;

var options = {
    camera :,
    canvas : viewer.scene.canvas

var kmlFile = "";
var kmlLoadPromise = Cesium.KmlDataSource.load(kmlFile, options);
Cesium.when(kmlLoadPromise, function(dataSource) {


Unfortunately, we don’t currently have relativeToGround support when terrain is enabled. It’s something we would like to add, but there are some technical challenges we need to solve first.