How to display position/velocity of selected entity

I am building an app that displays satellite trajectories from a CZML file (the CZML itself is written using Python’s czml3 library after simulating the trajectory based on user input). I load the CZML file using

viewer.dataSources.add(Cesium.CzmlDataSource.load(<URL>));

So far so good, the trajectory is displayed when I run the app. Now I want to display the current position and velocity of the satellite on screen. My questions are:

  • How can I achieve this? I think the way to go would be to get the object’s position and velocity via cesium and display it in an HTML div - but I can’t figure out how to get the satellite’s position/velocity. Could you please point me to an example (if any) that does this or something similar?

  • Is it possible to display the position/velocity in the infobox that appears when an object is clicked? I understand that we can put description in the infobox but I am not sure if we can put time-varying data in there too? In that case, how do I update the infobox constantly as the satellite moves along its trajectory?

Many thanks in advance!

Hi @Komal_Gupta , You can use callback property to get current position/velocity. There can be another approach also which I think will be more efficient and scalable.

Check this sandcastle example.

In this example you can display current position of selected entity (satellite). You can use VelocityVectorProperty. to calculate velocity. Please check this sandcastle example about it.

Let us know if you have anything to ask regarding this example.

  • Best Regards
  • Yash

Hi Yash,

Thank you so much for your help, the example was exactly what I needed - I implemented something similar to get the position/velocity as well as additional properties of the object and display them in the infobox.

Grateful to the Cesium community!

1 Like