How can I add a label to the entity (ex. Polygon) at the specify location:
This is how I tried to do it: (entity.polygon = true)
static addLabel(entity) {
entity.myLabel = new Cesium.LabelGraphics({
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
label : {
text : 'Philadelphia',
font : '24px Helvetica',
fillColor : Cesium.Color.SKYBLUE,
outlineColor : Cesium.Color.BLACK,
outlineWidth : 2,
}
})
}
There is no error, but it doesn't show up on the map.
the "label" is an object of the entity so try this:
entity.label= new Cesium.LabelGraphics({
position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),
text : 'Philadelphia',
font : '24px Helvetica',
fillColor : Cesium.Color.SKYBLUE,
outlineColor : Cesium.Color.BLACK,
outlineWidth : 2,
})
to hide it use
enity.label.show=false;