I’m presently using Cesium 1.20 and it is working fine. I am looking at upgrading it, just to keep things current, but when I use it at present I get the following warning in the Chrome console:
“KmlDataSource now longer takes a proxy object. It takes an options object with camera and canvas as required properties. This will throw in Cesium 1.21.”
I’ve looked ahead and sure enough, as of Cesium 1.22, this will be an issue for me.
My question is, how do I change my code to work correctly with later versions of Cesium?
Here’s a snippet of the code where I initialize my KML data source:
var baseLayerPickerViewModel = viewer.baseLayerPicker.viewModel;
baseLayerPickerViewModel.selectedImagery = baseLayerPickerViewModel.imageryProviderViewModels[2];
var datasource = new Cesium.KmlDataSource();
var terrainProvider = new Cesium.CesiumTerrainProvider({
url: ‘//assets.agi.com/stk-terrain/world’,
requestWaterMask: false
});
viewer.terrainProvider = terrainProvider;
viewer.dataSources.add(datasource.load(’<% =KmlUrl() %>’, {clampToGround: true})).then(function(datasource) {
viewer.clock.shouldAnimate = false;
viewer.clock.multiplier = 30;
viewer.flyTo(datasource, { duration: 4.0, offset: { heading: 0, pitch: Cesium.Math.toRadians(-45), range: 3000 } }).then(function() {
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
viewer.clock.shouldAnimate = true;
}
);
});