生成了由cesium显示的KML文件。 KML由坐标和高度(甚至是航向等)组成。轨道很好显示。现在,我想通过跟随此行的3D模型(带标题)显示当前使用的点(http://maps.google.com/mapfiles/kml/paddle/ylw-circle.png)。 需要在KML中完成吗?
答案 0 :(得分:0)
最佳答案取决于您是否能够修改KML。
如果可以,那么最好的解决方案是将glTF 3D模型添加到KML中。它会为您节省一点点复杂性。
否则你需要做这样的事情(粘贴到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;
});
});