How to add multiple orbits with different availability to viewer?

I’m trying to plot multiple orbits with different availabilities one after another in Viewer. Should I be processing the czml into separate CzmlDataSources or to just use one and repeatedly add new DynamicObjects into the CzmlDataSource’s dynamicObjectCollection? Right now the timeline does not adjust/expand when the second czml packet is added. I’m also seeing the latter’s leading and trailing paths being fully drawn outside of its availability timerange. Where would be the most appropriate update function to place the following snippet?

var objectList = dataSourceCollection.getObjects();

// Remove orbits not within current timeframe

if (objectList.length > 0) {

for (var i = 0; i < objectList.length; i++) {
var within = objectList[i].availability.contains(currentTime);

if (within) {

objectList[i].path.show.value = true;

}

else {

objectList[i].path.show.value = false;

}

}

}

Thanks!

Is there a reason you aren’t just using a single CZML file with both orbits in it? Otherwise, you need to adjust the timeline manually if you want to change it in response to new data being added.

If you can post the CZML, I can take a look and see if there are any issues causing the drawing outside the bounds you are seeing. You shouldn’t need the code snippet you posted above.

Hi Eugene.

I faced the similar issue during writing CZML generator for satellite tracker. I saw somewhere in source code of the Viewer that it sets the timeline based on availability of the first CZML file being processed. So I decided to build my application with CesiumWidget and create it with my own Clock instance with required startTime and stopTime. They can be changed manually at any time if you have a reference to Clock instance.

I was also able to split satellite’s orbit in separate packets with same IDs located in separate requests (files). A script generating the first part of the orbit is requested by loadUrl() method of CzmlDataSource, all the following script’s requests are processed by processUrl() method (you can see in documentation that this will preserve previously processed data). The only requirement is that CZML updating the existing packet must contain all availability intervals from previous CZMLs for this packet otherwise these intervals will be overwritten. I pass availability intervals to the script as an array of GET or POST parameters.