How to get the description property of a dynamic entity

I have added a czmlDataSource loading data with time bound entities (witch change over time). I want to retrieve a specific entity description property text (witch changes throughout the time line). I wish to display it on the cesium canvas. I want it to be updated like in the infobox.

I looked at the Sancastle example : http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=GeoJSON%20and%20TopoJSON.html&label=DataSources, witch was recommended in a answer to a similar question, but it did not show how to retrieve a time bound property.

I would greatly appreciate your asistance.

Br,

M. Aaron

Hello,

You’ll need to get the entity from the CzmlDataSource, and then you can get the description using getValue. Here is an example:

var promise = Cesium.CzmlDataSource.load(’/path/to/czml/’);
promise.then(function(dataSource) {
viewer.dataSources.add(dataSource);
var entities = dataSource.entities;
var myEntity = entities.getById(‘myEntityId’);
var description = myEntity.description.getValue(viewer.clock.currentTime);
});

``

Best,

Hannah

Hello, Hannah, Thanks for the response.

Your code is good enough for getting the description value at current time, but my goal is to diaplay the value on the cesium canvas throughout the timeline, so I need it to be updated automatically, like with the infobox that its value changes when the description of the selected entity changes throughout the timeline. Is there a way to register for getting an event every time the value of the discription changes throughout the timeline?
If so, then it will be easy to use your suggested code and update my element that will be displayed on the canvas.
If there is a solution, may you please give a short example?

For the InfoBox, we add a listener to the clock onTick event and check the value of the name and description for the selected entity.

Here’s how we register the listener: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Widgets/Viewer/Viewer.js#L434

And here’s the code that updates the name and descrition: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Widgets/Viewer/Viewer.js#L1519-L1532

-Hannah