Can we animate 3D vehicle tracking based on real time / interval based data using cesium?

Using history of data or array of data we can track cesium vehicle(flight tracker). But I’m going to create a ground Vehicle Tracking by passing packets of data( [{ lon: 78.60834078421288, lat: 19.977258721643523, “height”: 0 }] ) for each 10 seconds. Is this possible?? or should we need to pass array of data like (flight tracker)?? Is there any limitations/ restriction in cesium for this??

Hi @abstractAshwath,

I believe that both of the options that you outlined are viable. The specific details of the implementation would depend on the scope of your application.


Hi @sam.rothstein,

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 you please help me in this part.


Hi @abstractAshwath,

I played around with your sandcastle example for a little bit. It seems like your application is failing with the following command:

Uncaught RuntimeError: An entity with id KA1012 already exists in this collection.

Please ensure that you are not adding multiple primitive objects to your primitiveCollection that have the same name or ID. The error that you are receiving indicates that you have added multiple primitive objects with the name KA1012.


Hi, @sam.rothstein , Thanks for your reply
I used the Vehicle id as a param, because I am performing Single vehicle real time tracking.
Here we are reassign the position data to the vehicle entity that’s why we are getting the RuntimeError.

So my 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.
Is this possible to reassign the position data(positionProperty) to the vehicle entity once it’s finishes the track??

Hi @abstractAshwath, it still looks to me like you are adding multiple entities to your scene. Please see line 103 from the sandcastle example that you shared
const vehicle = map.entities.add({
I recommend that you ensure that you are not adding multiple entities to your scene with the same name. Also, ensure that you are updating the position property of your vehicle entity (rather than creating a new one).

1 Like

Hello @abstractAshwath, I can say - @sam.rothstein have realy correct fix -
you added new model with non-unicum id’s in each part.
Its simple fixed.
& also will need update position.
But its all.

Hi @sam.rothstein thanks, I had made some changes,
Now I am not getting any RunTimeError , but the issue is each time it will take starting point as an initial point when I was push third, fourth packet.
When I push third packet it should consider second packet as starting point and third packet as end point for 30 sec interval of time.
Could you help me in this part.


Hi @abstractAshwath,

Thanks for the update - I am happy to hear that you are no longer getting a runtime error. Out of curiosity, what changes did you implement?

Regarding your current issue, it would be helpful if I could see a sandcastle demo that showcases what you have so far. It seems like you need to be more meticulous on how you are updating your starting and ending points.


Hi @sam.rothstein ,
I just want to implement real time vehicle tracking based on gps data.

  1. For each 10 seconds I receive a packet of data ( [{ lon: 78.60834078421288, lat: 19.977258721643523, “height”: 0 }] ) or ( [{ lon: 78.60834078421288, lat: 19.977258721643523, time: “2020-03-08T02:10:00Z” }] )
  2. Once I push packet-1 then it should take it as a start point and packet-2 as end/stop point. Once the vehicle reaches the end point with 10 sec we push another packet-3.
  3. In the next scenario packet-2 is act as a start point and and packet-3 is act as a end/stop point. This process goes on like this.

I have already implemented this but I facing some issues like,

  1. Each time the vehicle takes starting point as packet-1.


See this:

  1. Your code is too messy and needs to be simplified
  2. Don’t add entities with same id, that is what sam said. You could save the entity and remove it before you add a new one.
  3. The key of your problem is that you should push your waypoint in every function call when length of
    positions > 1, but you wrote wrong:
// wrong

// fixed

Hi @Gu-Miao ,
Thanks, It’s working.!!!
I am going to perform Single vehicle tracking, that’s why I added the same ID to the entity. Understood and I avoid that mistakes in future.
Thanks, Once again!!

You’re welcome. It’s happy to hear that. cheers😊

1 Like