Polygon entity fails to update when color property changes from dynamic to static

Hey guys (mostly Matt I guess!),

I’m running into what I’m pretty sure is a bug with CZML / DataSources. Here’s a Sandcastle example to show it:

var czml = [{

"clock": {

    "currentTime": "2016-01-01T00:00:00Z",

    "interval": "2016-01-01T00:00:00Z/2024-12-31T23:59:58Z",

    "range": "LOOP_STOP",


    "multiplier": 20000000


"name": "test",

"version": "1.0",

"id": "document",

"properties": null

}, {

"polygon": {

    "material": {

        "solidColor": {

            "color": {

                "rgba": [0, 255, 0, 179]




    "positions": {

        "cartographicDegrees": [144.991, -37.914, 0.0,

                                144.991, -37.720, 0.0,

                                145.284, -37.720, 0.0,

                                145.284, -37.914, 0.0]


    "outlineColor": {

        "rgba": [50, 50, 50, 255]


    "outline": true


"name": "Something",

"description": "foo"


var viewer = new Cesium.Viewer(‘cesiumContainer’);

var dataSource = Cesium.CzmlDataSource.load(czml);



var options = [{

text : 'Static Green',

onselect : function() {

    viewer.dataSources.get(0).entities.values[0].polygon.material = Cesium.Color.fromCssColorString('#00FF00');


}, {

text : 'Static Red',

onselect : function() {

    viewer.dataSources.get(0).entities.values[0].polygon.material = Cesium.Color.fromCssColorString('#FF0000');


}, {

text : 'Time dynamic blue',

onselect : function() {

    var tic = new Cesium.TimeIntervalCollectionProperty();

    tic.intervals.addInterval(new Cesium.TimeInterval({

        start: Cesium.JulianDate.fromIso8601('2015-01-01'),

        stop: Cesium.JulianDate.fromIso8601('2025-01-01'),

        data: Cesium.Color.fromCssColorString('#0000FF')


    viewer.dataSources.get(0).entities.values[0].polygon.material = new Cesium.ColorMaterialProperty(tic);





If you run that and switch between the “Static Green” and “Static Red” options, the polygon changes color as expected. You can also switch from either static options to the dynamic one, and the polygon turns blue as expected.

However, if you switch back from Time dynamic blue to either of the static options, the polygon color doesn’t change.

I’ve tracked this down to this line:


where the correct color gets overwritten by the previous one. But I’m not sure what needs to change, as I’m not sure what problem this code as intended to solve. It was added in this commit:


But it doesn’t make much sense to me. Why do attributes from the previous batch need to be copied over when switching batches? Shouldn’t the attributes in the new batch just be derived from the current properties of the entity?

Matt, I’m happy to fix and PR this if you can give me some insight into what needs to change.



Thanks Kevin! I made a GitHub issue so we don’t lose track of this: https://github.com/AnalyticalGraphicsInc/cesium/issues/3807


Thanks, Hannah. In case anyone is wondering, my use case is selection. The user clicks on a polygon and I want to highlight it by changing its material to a different color. This works great when the polygon’s color is static, but it doesn’t work at all when the color changes with time.