Cesium 3D Vehicle tracking based on real time data

I am going to create 3d Single vehicle track based on real time / interval based data, for each 30 sec we need to push the data to the vehicle entity. I refer flight-tracker to implementing the real time track.
I am facing some issues like if I push the first packet the it will move from one point to another point location, again if I push fresh packet of data It will start the track from the first, and also the vehicle is disappear from the window. I have added the sandcastle example for your reference.
Could anyone help me in this part.


Hi @abstractAshwath,
I’ve gone through your sandcastle example and found few mistakes.

  1. Rather than re-assigning a new SampledPositionProperty everytime to push new waypoints in that, you can use previously assigned SampledPositionProperty.
  2. You are trying to create entity (with same ID) everytime you push new waypoint.
  3. You are resetting clock currentTime to startTime inside loop.

Here is the modified example link. I’m not sure if this is what you are looking for. Please check line number (22 to 26), (85 to 88) and (108 to 124).
Let us know here if that meets your requirement or not…

  • Regards,

Hi @Jacky ,
Thanks for your reply, I have checked the modified example it’s almost near to my requirement.

The requirement is each 30 sec we are getting the point data [Lat , Lon] as a packet. The vehicle should start track by taking first packet as starting point and second packet as end point like that, If I push third packet on that time it will takes second packet as starting point and third packet as end point.

Here we are getting some challenges like, once the vehicle reach to end point the vehicle model will be disappear. And it will take 30 sec time for the whole packets.


To disappear vehicle model after completing it’s journey, you may forwardExtrapolationType property(In case of SampledPositionProperty) OR can set entity availability property.

I’ve re-modified the example and removed some codes which were confusing me. In this example vehicle is taking 30 secs to complete distance between 2 points.

I hope it fulfils your requirement.

  • Regards

It is working fine for first two packets of data, it accepts 30 sec for first two packets.
If I push third packet data on that time it is not working as I mentioned before. It only accepts 30 sec for whole packets.
Once it reaches the end point (destination), should we need to reassign the data packets to the positionProperty ?? Line number 101.


So you want vehicle to complete entire distance in 30 secs? If it is, then yes it needs to re-assign positionProperty with all data packets. Example

A Big NO!!, For two points the time duration is 30 sec only, not for whole packet.
After pushing 3rd packet of data again time should reload 30 sec.

Here it takes 30 sec to complete whole packets of data. This is wrong.!!

Sorry Mate,
I don’t have spare time to continue resolving your issue on this topic. If you want to complete entire distance in 30 secs, you can change this line (100):
var singleTimeStep = timeStepInSeconds/(routepath.length-1);
var singleTimeStep = timeStepInSeconds;

and also keep line number 97,98 out of the for loop:

const positionProperty = new Cesium.SampledPositionProperty();
positionProperty.forwardExtrapolationType = Cesium.ExtrapolationType.NONE;

Ok, Thank you @Jacky
It helps me a lot…!!