All CZML entities disappear upon their programmatic selection

Hi everyone,

I am loading some entities (points) through CZML. Once the loading is done, I am adding all of them iteratively in addToolBarMenu and attaching an onlick event with them. This part works good and I am able to see all the entities in a drop-down.

Now when I try to click/select any of them from the drop-down, associated onclick function is called which should make that entity as trackedEntity but it just disappears all the entities. Here is my code snippet:

var entities_selection = ;

var promise = Cesium.CzmlDataSource.load(‘entities.czml’);

promise.then(function(dataSource) {

viewer.dataSources.add(dataSource);

//Get the array of entities

var entities = dataSource.entities.values;

for (let i = 0; i < entities.length; i++) {

let entity = entities[i];

entities_selection.push({

text : 'Entity: ’ + entity.name,

onselect : function() {

viewer.trackedEntity = undefined;

viewer.trackedEntity = entity;

}

});

}

Sandcastle.addToolbarMenu(entities_selection);

});

Correct behavior is that on selection of any entity from the drop-down, system should make it as trackedEntity. However, it just disappears all the entities. They do exist invisibly i.e. selection indicator shows me the movement of point over time but they are not visible.

Any guess why I am getting this behavior?

So I think I have found the issue but still don’t know the answer.

I have some entities where were added directly as ‘viewer.entities.add(…)’ and I also have some entities which were loaded through CZML. Now when I programmatically tries to **flyTo **or **zoomTo entites **which were loaded through CZML (as in the code snippet I posted), they just become **invisible **for some weird reasons BUT the ones which were added directly as viewer.entities.add(…) remains visible.

Any idea?

Hello,

Your issue might be from this code:

for (let i = 0; i < entities.length; i++) {

let entity = entities[i];

``

That should be var i = 0; and var entity = …

Best,

Hannah