I have a process where I have a simulation that is generating CZML files in 30 minute increments. When I try to load more than one of these in my cesium viewer I can only see one of them.
The web application is a Drupal site with the cesium module. That is how I get the files selected from a form to the cesium viewer code.
Here is the code I’m using.
(function ($) {
Drupal.behaviors.cesium = {
attach: function (context, settings) {
var viewer = new Cesium.Viewer('myApp-cesium', {
imageryProvider : new Cesium.createOpenStreetMapImageryProvider(),
sceneMode : Cesium.SceneMode.COLUMBUS_VIEW, //SCENE3D,
baseLayerPicker : false,
fullscreenButton: true,
geocoder: false,
fullscreenElement: 'myApp-cesium',
timeline: true,
animation: true,
navigationInstructionsInitiallyVisible: false,
homeButton: false,
// Turn off the skybox (i.e. stars)
skyBox : new Cesium.SkyBox({
sources : {
positiveX : 'skybox_px.png',
negativeX : 'skybox_nx.png',
positiveY : 'skybox_py.png',
negativeY : 'skybox_ny.png',
positiveZ : 'skybox_pz.png',
negativeZ : 'skybox_nz.png'
},
show : false}),
// Show Columbus View map with Web Mercator projection
mapProjection : new Cesium.WebMercatorProjection()
});
//Add basic drag and drop functionality (do not overwrite existing datasources)
viewer.extend(Cesium.viewerDragDropMixin, { clearOnDrop : false });
var missions = [];
var czmlLoaded = false;
var nfiles = Drupal.settings.atlantis_mti.nfiles;
console.log('Loading ’ + nfiles + ’ files: ‘);
for (i=0; i<nfiles; i++) {
var file = Drupal.settings.atlantis_mti.czmlFiles[i];
console.log(’ ’ + file);
missions[i] = new Cesium.CzmlDataSource().load(file);
missions[i].show = true;
viewer.dataSources.add(missions[i]);
czmlLoaded = true;
}
// Zoom to the first data soure that was loaded
if (czmlLoaded) {
viewer.zoomTo(missions[0]);
}
}
};
}(jQuery));