timeline.addTrack issue

Hi there!

New to Cesium here, I’m looking to add multiple track on the timeline. Unfortunatly it seems only the first one works. My code goes like this:

for ( **Iterate throught time intervales **) {
viewer.timeline.addTrack(
new Cesium.TimeInterval({
start : intervale_start_time,
stop : intervale_end_time
}),
8, // Height
Cesium.Color.BLUE,
Cesium.Color.BLACK
);
}

Am I using it wrong?

Hey, I am facing similar issue. Did you figure it out?

For those looking for answer. You need to update the track interval and call updateFromClock, zoomTo methods from timeline.

const viewer = new Cesium.Viewer(“cesiumContainer”);
let time1 = new Cesium.TimeInterval(
{
start : Cesium.JulianDate.fromIso8601(‘2023-11-24T00:00:00.000Z’),
stop : Cesium.JulianDate.fromIso8601(‘2023-11-25T06:00:00.000Z’)
}
);

let time2 = new Cesium.TimeInterval(
{
start : Cesium.JulianDate.fromIso8601(‘2023-11-25T06:00:00.000Z’),
stop : Cesium.JulianDate.fromIso8601(‘2023-11-26T00:00:00.000Z’)
}
);

let track = viewer.timeline.addTrack(time1,
30, // Height
Cesium.Color.BLUE,
Cesium.Color.RED
);

track.interval = time2;
viewer.timeline.updateFromClock();
//set the new current time
viewer.timeline.zoomTo(
viewer.clock.startTime,
viewer.clock.stopTime
);

1 Like