force realtime for czml data display & fixed camera look angle

Hi,

I'm displaying czml content in a 3D scene with a camera view in ICRF. Since I update the czml file periodically I force a browser refresh every so many seconds using the <meta http-equiv="refresh" content="600"> html command.

This seems to work reasonably well but I have two problems:

1. upon refresh the scene displays at the start time of the clock interval as defined in the czml file and I always have to press the realtime button to make it display the actual current time. Is there a way to force Cesium to initialize with displaying realtime instead of starting at the czml's clock interval start time(the actual realtime is covered by the czml's interval)? I have set the clock multiplier to 1 as recommended in post https://groups.google.com/forum/#!topic/cesium-dev/g58mafIY95U but that only affects the simulation speed, not the actual time.

2. Pressing the realtime button always changes the camera's look angle. Is there a way to prevent that from happening?

Thanks for your help,

Arnold

Hello Arnold,

You might want to consider using the CzmlDataSource.process function. It lets you update an existing CZML datasource with new data.

If that doesn’t work for you, you could also remove the datasource using viewer.datasources.remove(myCzmlDatasource) and add a new one.

Best,

Hannah

Not sure if you’re using this already – websockets…

Following Hannah’s approach, you could use Websockets to open up the czml stream and whenever there is an update to the czml, you would just use CzmlDataSource.process or CzmlDataSource.load depending on your use case. There would be some backend component pushing out the czml data.

Thank you for your replies. I have tried using it from the Javascript side of things by running an interval function that first removes the dataSources and then reattaches an updated version. This resolved my issue number 2 (the camera look angle doesn't change anymore between updated).
However, every time the function is called the Cesium simulation time resets to Jan 01, 0 00:00:00 and I still have to press the realtime button to display the scene as intended. Is there a Cesium function that I can call in the update function which does exactly the same thing as pressing the realtime button?

    var myVar = setInterval(function() {myTimer(viewer); }, 100000);
    function myTimer(viewer) {
      viewer.dataSources.removeAll();
      dataSource = Cesium.CzmlDataSource.load('datafile.czml');
      viewer.dataSources.add(dataSource);
      TBD: I would like some function to force realtime here....
    }

Thanks,
Arnold

Ok I found the solution here: http://stackoverflow.com/questions/28124830/live-streaming-and-processing-of-czml-packets-in-cesium
The viewer object must be constructed with 'automaticallyTrackDataSourceClocks:false' e.g.:

var viewer = new Cesium.Viewer('cesiumContainer', {
  automaticallyTrackDataSourceClocks : false
}
  
That prevents the simulation clock from changing every time the czml is updated...