Geojson floating and shifting on the terrain

It looks like there’s a bug in GeoJsonDataSource.js:306 where the logical operator should be ‘or’ rather than ‘and’ to effect what the comment indicates.

// Clamp to ground if there isn’t a height specified

if (coordinates.length === 2 || options.clampToGround) {

billboard.heightReference = HeightReference.CLAMP_TO_GROUND;

}

``

Here’s my Sandcastle example which works as expected after making the above change.

var stkWorldTerrain = new Cesium.CesiumTerrainProvider({

url: ‘//assets.agi.com/stk-terrain/world

});

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

terrainProvider: stkWorldTerrain,

baseLayerPicker: false

});

var geojsonObject = {

‘type’: ‘FeatureCollection’,

‘features’: [{

‘type’: ‘Feature’,

‘geometry’: {

‘type’: ‘Point’,

‘coordinates’: [-75.5966, 40.0386, 5075.9392]

}

}]

};

// Cesium.GeoJsonDataSource.clampToGround = true;

var promise = Cesium.GeoJsonDataSource.load(geojsonObject, {

clampToGround: true,

markerColor: Cesium.Color.AQUA

});

promise.then(function(dataSource) {

viewer.dataSources.add(dataSource);

viewer.zoomTo(dataSource.entities);

});

``

Scott