Adding labels in cesium

var entities3 = dataSource3.entities.values;

    var colorHash = {};
    for (var i = 0; i < entities3.length; i++) {
        var entity = entities3[i];
        var label;
        var name =;
        var color = colorHash[name];
        if (!color) {
            color = Cesium.Color.BROWN;
            colorHash[name] = color;
        entity.polygon.extrudedHeight =;
        label = {
            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.

Try using a LabelGraphics object instead.


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.

See our Visualizing Spatial Data tutorial: