I have a KML file that is loaded as a datasource.
The viewer correctly sets the timeline bounds, and starts playing the track. However, at the end it goes back to the beginning immediately.
I though that the clock.clockRange was a property to control this behaviour, but no matter what I set the clockRange to, the animation restarts at the beginning over and over again.
Do I need to set the clock.stopTime manually to something? If so, how do I set it to just be the last time in the track? Or am I missing something…
Settings clock.clockRange to ClockRange.CLAMPED is definitely the way to do this. Your problem is mostly likely that loading your KML file is overwriting the clockRange setting. You need to set the value after the load is completed.
var loadPromise = Cesium.KmlDataSource.load(‘kmlFile.kml’);
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
The other option is to pass “automaticallyTrackDataSourceClocks : false” as part of the Viewer options object, which will prevent the Viewer from making any clock changes when data is loaded, and then you can retrieve information from the Datasource via the KmlDataSource.clock property.
Thanks, yes I think you must have been right.
It now works.