var entities3 = dataSource3.entities.values;
var colorHash = {};
for (var i = 0; i < entities3.length; i++) {
var entity = entities3[i];
var label;
var name = entity.properties.Height;
var color = colorHash[name];
if (!color) {
color = Cesium.Color.BROWN;
colorHash[name] = color;
}
entity.polygon.extrudedHeight = entity.properties.Height;
label = {
text: entity.properties.Name,
font : '12px Helvetica',
fillColor : Cesium.Color.WHITE,
outlineColor : Cesium.Color.BLACK,
outlineWidth : 4,
style : Cesium.LabelStyle.FILL_AND_OUTLINE,
verticalOrigin : Cesium.VerticalOrigin.BOTTOM,
pixelOffset : new Cesium.Cartesian2(0, -9)
};
entity.label = label;
}
But there is no labels appearing.
hannah
2
Try using a LabelGraphics object instead.
-Hannah
The problem is that you do not specify a top level “position” property for the entity, so it doesn’t know where to put the label.
LabelGraphics also doesnot work.
@Matthew: How should i set position for the labels? I am new to cesium. I hope position will solve the problem.