Problem Adding Additional CZML DataSources while Processing CZML Packets

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

Adding additional CZML files to Cesium eliminates/stops the processing of CZML packets. Adding the facilities (AFSCN.czml) file via the code below does not eliminate/stop the process however, when adding CZML files that contain converted satellite Two-Line-Element (TLE’s) stops the the CZML packets from being processed.

___***I made sure that all CZML files/TLE’s are in the availability interval of the associated CZML packet data. _ __

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

////
// AUTO ADD AFSCN
var dataSourceAFSCN = new Cesium.CzmlDataSource();
dataSourceAFSCN.load(’…/…/…/CZML/AFSCN.czml’);
viewer.dataSources.add(dataSourceAFSCN);
//
//

var czmlEventSource = new EventSource(czmlStreamUrl);
if (window.top !== window) {
// DEBUG
//console.log(“I have a parent”,window.document.title,window.top.document.title);
parent.postMessage(“hello”,"*");
window.addEventListener(“message”, function(event) {
var obj = JSON.parse(event.data);
czmlStream.process(JSON.parse(event.data));
});
} else {
// DEBUG
//console.log(“I have no parent”,window.document.title,window.top.document.title);
czmlEventSource.addEventListener(‘server-time’, function (e) {
czmlStream.process(JSON.parse(e.data));
});
}

``

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

I want to add CZML files dynamically while processing the CZML packets.

Do I need to edit the epoch in the CZML files or do something with the clock source?

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

Update: it looks like the converted TLE to CZML time (not sure why) was wrong so I went ahead and just used the CZML exporter plugin via STK to set the exact times.

So, now I can see the ingested CZML file (satellite) but now the clock resets back to epoch specified in the CZML file and stops the processing code above.

Is there a way to sync up the added CZML file with the processed CZML packets?

It’s hard to tell what the issue is without seeing the CZML document or some sample packets. One thing I know is that if the packets contain clock settings, the CesiumJS viewer will automatically use those to set the simulation clock. You can set the automaticallyTrackDataSourceClocks in the Viewer options to false to disable this, but then you’ll have to set the scene start/end time yourself.

Thanks Omar,

I need to have the Cesium clock to be in sync with the processed CZML packets so I do not think setting the automaticallyTrackDataSourceClocks will work - unless you disagree.

Is there a way to have the loaded CZML file be updated to the currentTime of the Cesium clock when it is loaded in - maybe by getting entity getId and then setting some parameter?

Please let me know - thank you.

HI Omar,

I figured I should I try this out when loading the CZML file: Instead of loading the CZML file directly, I read in a JSON file with the CZML contents, obtained the current time of the Cesium clock. and modified the JSON file to replace the current time in the file with that of the Cesium current time as well as replaced the Position epoch, and Quaternion Epoch to match.

This works, however, the processed dynamic CZML packets that are being ingested are not updating via the Cesium clock to reflect current time in that packet --> this means that the Cesium time is not in sync with the contents of the CZML packets being ingested. I hope that makes sense.

Any thoughts on how to force Cesium to honor the CZML packets after the external JSON data is loaded described above?

If that is not feasible, maybe I should just load in the all the CZML files at Cesium start up and then hide the entities? (how would you go about to do this?) However, I think I will have to deal with the same problem where the CZML packet current times are not being honored and time will be out of sync.

Please let me know and thank you.