CustomDataSource - Change entity.polygon outline after entityCollection hide and show

**Hi guys, **

I am trying to change the entity.polygon.outline of a custom datasource onclick. Everything works fine except for the first change done to the entity.polygon.outline after datasource show property is changed. Cesium version : 1.32

Sample to show the problem:

var dataSource = new Cesium.CustomDataSource();

var entities = dataSource._entityCollection.values;

dataSource._entityCollection.add(new Cesium.Entity({

polygon : {

hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 37.0, -115.0, 32.0,

-107.0, 33.0, -102.0, 31.0, -102.0, 35.0]),

material : Cesium.Color.RED.withAlpha(0.35),

outline: true,

height: 1




entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.RED); // Works

}, 5000);

**setTimeout(function(){ ** = false; = true;console.log(‘Datasource : show’);

}, 10000);


entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK); // Doesnot work

}, 15000);


entities[0].polygon.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK); // Works

}, 20000);

//Create a Viewer instances and add the DataSource.

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

animation : false,

timeline : false


viewer.clock.shouldAnimate = false;


Could someone help me with this?

Thanks in advance,


Hi Monisha,

Unfortunately, this is a known bug that we haven’t gotten a chance to fix yet. There’s an issue for it open here:

I’ve linked to this post so we can update you when we address it.

In the meanwhile, hopefully you can find a workaround – if you’re not doing anything too performance heavy you could for instance swap out the entity for just a new one entirely with a new color (although this will be more costly).

Hope that helps,

  • Rachel