How does the green selection indicator tracking work?

Hi,

I am trying to understand how to keep Cesium’s green selection indicator’s tracking when updating an entity’s location.

I am using Resium (a popular Cesium React wrapper), and manage moving cars on a map.
The cars data is saved in a React state, from which I map them to Entities.

When I receive an updated location from a server and update the coordinate’s the selection is gone.
But if I SORT the data accoring to a unique identifier, so that their order remains consistent, the they are still tracked.

I’ll note that I gave each entity a unique, consistent, “id” field.

So I am not sure how the tracking works under the hood

Hi @hechtV Welcome in Cesium Community!

I’m also at beginner level to understand how does entity selection works under the hood.
But if you wants to trigger entity selection (to display green selection box), you can execute following code in a loop where selected_entity_by_id is the entity you want to track. You can set viewer.selectedEntity = undefined; to deselect the entity.

viewer.selectedEntity = selected_entity_by_id;

Remember, you can select one entity at a time.

  • Regards