How can I hide one particular label in a collection of many?

I can add multiple labels to the entity from an array (in this case pmbo.PoI) referencing their specific lon, lat and height.

However I wish to be able to turn specific labels on and off at different times.

How can I reference a specific label and hide/show it whilst leaving the others unaffected?

Here's my code extract which adds the labels to the entity...

viewer.entities.add({

position: Cesium.Cartesian3.fromDegrees(pmbo.PoI[iP].lon, pmbo.PoI[iP].lat, pmbo.PoI[iP].ele),

label:{ text: pmbo.PoI[iP].name }

});

Thanks

Hello,

If you give the labels ids, you can use that ID to get the label and set the show property. Here is an example:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

viewer.entities.add({
id: ‘label1’,
position: Cesium.Cartesian3.fromDegrees(-114.0, 40.0, 300000.0),
label : {
text : ‘label 1’
}
});

viewer.entities.add({
id: ‘label2’,
position: Cesium.Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
label : {
text : ‘label 2’
}
});

viewer.entities.getById(‘label2’).show = false;

``

Best,

Hannah

That's awesome thanks so much!