Centered label for a polygon

Currently I’m adding a polygon like this

viewer.entities.add({

polygon: {

hierarchy: new Cesium.PolygonHierarchy(myPositions)

}

});

``

To add a label to this polygon I extent this to this

viewer.entities.add({

label : {

text : ‘MyArea’

},

polygon: {

hierarchy: new Cesium.PolygonHierarchy(myPositions)

}

});

``

But label is not displayed now, because position is missing. Is there a possibility to show label at center of polygon like the Entity rectangle, which appears if you click on a Entity, without calculation of center of polygon by my own?

Hi SunBlack,

Check out this thread on the same subject: https://groups.google.com/forum/?hl=en#!searchin/cesium-dev/center$20label$20polygon|sort:date/cesium-dev/zAJwEbd9irQ/YAQoZxogAQAJ

Hope that helps,

  • Rachel