Got a KML file generated that is displayed by cesium. The KML consists of coordinates and altitudes (even heading etc). The track is well displayed. Now I like to display the currently used dot (http://maps.google.com/mapfiles/kml/paddle/ylw-circle.png) by a 3D model which follows this line (with heading). Need this be done in the KML ?
The best answer depends on if you are able to modify the KML.
If you can, then the best solution is to add the glTF 3D model to the KML. It will save you a tiny bit of complexity.
Otherwise your going to need to do something like this (paste into Sandcastle):
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProviderViewModels : [], //Disable terrain changing
infoBox : false, //Disable InfoBox widget
selectionIndicator : false //Disable selection indicator
});
//Enable lighting based on sun/moon positions
viewer.scene.globe.enableLighting = true;
viewer.dataSources.add(Cesium.KmlDataSource.load('../../SampleData/kml/bikeRide.kml')).then(function(dataSource) {
viewer.clock.shouldAnimate = false;
//Create the entity after KML loaded
var entity = viewer.entities.add({
position: dataSource.entities.getById('tour').position,
model: {
uri: '../../SampleData/models/CesiumGround/Cesium_Ground.bgltf',
minimumPixelSize: 64
},
path: {
resolution : 1,
material : new Cesium.PolylineGlowMaterialProperty({
glowPower : 0.1,
color : Cesium.Color.YELLOW
}),
width : 10
}
});
viewer.flyTo(entity).then(function () {
viewer.trackedEntity = entity;
viewer.selectedEntity = viewer.trackedEntity;
viewer.clock.multiplier = 15;
viewer.clock.shouldAnimate = true;
});
});