Adding New CZML DataSources w/o Removing Existing Data

1. A concise explanation of the problem you’re experiencing.

I have a drop down toolbar that allows the user to select CZML files to add to Cesium. When the user selects one DataSource and then selects a different DataSource, the latter overwrites the first DataSource selection, i.e. removes it.

How can the user select both of the CZML datasources without removing any existing data?

Thank you!

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

text : ‘Basic’,
onselect : function() {

}, {
text : ‘blah’,
onselect : function() {

var dataSourcePromiseS = Cesium.CzmlDataSource.load(czmlS);
}, {
text : ‘Last 30’,
onselect : function() {

var dataSourcePromise30 = Cesium.CzmlDataSource.load(czml30);
}], ‘toolbar’);


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

4. The Cesium version you’re using, your operating system and browser.

Also, the following does not work even when dropping CZML files in. However, I would like to do this via code.

viewer.extend(Cesium.viewerDragDropMixin, { clearOnDrop : false });


By default, Sandcastle will not remove anything when you select the different items. If you used an example like this as a reference:

Sandcastle.reset = function() {


viewer.clock.clockRange = Cesium.ClockRange.UNBOUNDED;

viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;



Specifically, the dataSources.removeAll() function is what clears the previous data.

Notice the Sandcastle.reset function defined at the bottom: