Time Lag

Hello.

My name is Natasha. I am working on creating a visualization using Cesium that illustrates the movement of New Jersey residents during a typical day. I am starting out developing this visualization by being able to visualize one vehicle moving. I have a pre-existing data set that includes the location and time of the origination point and destination point of New Jersey residents.

I tried producing a visual of just one trip made in New Jersey before extending the visualization to thousands of trips. I came across a problem, however. For some reason, the vehicle takes 4 extra hours in completing its path than it should. When I changed the time interval of the "availability" property from the original time I used to the ending time minus 4 hours, this problem was alleviated.

Is this a bug in Cesium or is there something wrong with my code? Here is an example of the code I am using:

<!DOCTYPE html>
<html lang='en'>
<head>
<title>NJTravelers</title>
<script src='Cesium/Cesium.js'></script>
<style>
@import url(Cesium/Widgets/widgets.css);
#cesiumContainer {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;
padding: 0;
font-family: sans-serif;
}
body {
padding: 0;
margin: 0;
overflow: hidden;
}
</style>
</head>
<body>
<div id='cesiumContainer' class='fullSize'></div>
<div id='loadingOverlay'><h1>Loading...</h1></div>
<div id='toolbar'></div>
<script>
var builtInCzml = [{
'availability' : '2012-08-04T01:37:47Z/2012-08-04T22:11:34',
'billboard' : {
'image' : 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEISURBVEhLvVXBDYQwDOuojHKj8LhBbpTbpBCEkZsmIVTXq1RVQGrHiWlLmTTqPiZBlyLgy/KSZQ5JSHDQ/mCYCsC8106kDU0AdwRnvYZArWRcAl0dcYJq1hWCb3hBrumbDAVMwAC82WoRvgMnVMDBnB0nYZFTbE6BBvdUGqVqCbjBIk3PyFFR/NU7EKzru+qZsau3ryPwwCRLKYOzutZuCL6fUmWeJGzNzL/RxAMrUmASSCkkAayk2IxPlwhAAYGpsiHQjbLccfdOY5gKkCXAMi7SscAwbQpAnKyctWyUZ6z8ja3OGMepwD8asz+9FnSvbhU8uVOHFIwQsI3/p0CfhuqCSQuxLqsN6mu8SS+N42MAAAAASUVORK5CYII=',
},
'position' : {
'interpolationAlgorithm' : 'LAGRANGE',
'interpolationDegree' : 1,
'epoch' : '2012-08-04T00:00:00Z',
'cartographicDegrees' : [5867, -74.7736068388625, 39.29797395079595, 0.0,
7894, -75.04907122590834, 39.428219971056436, 0.0]
}
}];
function useBuiltInCzml() {
viewer.dataSources.removeAll();
var czmlDataSource = new Cesium.CzmlDataSource();
czmlDataSource.load(builtInCzml);
viewer.dataSources.add(czmlDataSource);
}
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.extend(Cesium.viewerDynamicObjectMixin);
useBuiltInCzml();
</script>
</body>
</html>

I would really appreciate any feedback on the subject!

Thanks,
Natasha

Hi Natasha,

This is just a hunch without having studied your CZML in detail, but a four hour time difference just happens to be the difference between New Jersey’s current local time zone and UTC. Could it be just a time zone problem somewhere along the way?

Kevin

That is certainly a good point. I am still confused though. Even with the time zone difference, the time interval is still supposed to be 44 minutes and not 4 hours and 44 minutes. The vehicle starts at the correct time, that is 1:37am, however, it goes till the wrong time, 6:11am rather than 2:11am. This shouldn't happen even with the difference in time zone, right?

Also, thank you for the remarkably quick response!

Your CZML specifies this availability:

‘availability’ : ‘2012-08-04T01:37:47Z/2012-08-04T22:11:34’

Notice that the first time has a Z at the end, but the second one does not. Z means Zulu time, or UTC. The second time, because it does not have a Z, is specifying a local time (UTC-4 in your case). That means that that availability is equivalent to writing:

‘availability’ : ‘2012-08-04T01:37:47Z/2012-08-05T02:11:34Z’

Does that help explain what you’re seeing at all? I’m still a little confused because you said the route should be 44 minutes, but that looks like one day and 44 minutes. Still, using a consistent time zone throughout your CZML should make it easier to figure out what’s going on, at least.

Kevin

Hi Kevin,

Yes, that makes a lot of sense. Thank you for the explanation. Now my code is working perfectly!

Also, that was an error in the code that I posted. The 'availability' should have been: 'availability' : '2012-08-04T01:37:47Z/2012-08-03T22:11:34' in which case it is a 44 minute time interval rather than a 1 day and 44 minute interval.

Thanks,
Natasha