Polygon Hierarchy

I am experiencing an issue when trying to use the polygon hierarchy. I created a sandcastle example that shows the issue. The outside and inside polygons draw just fine on their own but when I set the inside polygon to a hole, the result is incorrect.

Any ideas?

Thanks in advance,

OG

var viewer = new Cesium.Viewer('cesiumContainer');

Sandcastle.addDefaultToolbarButton('Outside Ring', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":1757344.1780213583,"y":647229.2581826366,"z":6076562.679864116},{"x":2652901.294209005,"y":-3818081.9914601683,"z":4351708.617454816},{"x":1708391.4177992684,"y":-6141499.230329198,"z":209100.18642667998},{"x":-518882.85347091674,"y":-4984862.003384907,"z":-3931712.274062728},{"x":-2734028.806781344,"y":-1006941.8720557253,"z":-5654757.474178011},{"x":-3628199.327763546,"y":3457493.058045505,"z":-3931712.2740627294},{"x":-2683204.532055827,"y":5782475.894605995,"z":209100.18642667856},{"x":-457314.81430675916,"y":4626715.739154917,"z":4351708.617454815},{"x":1757344.178021357,"y":647229.2581826397,"z":6076562.679864116}]},

            material : Cesium.Color.BLUE.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

Sandcastle.addToolbarButton('Inside Ring', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851},{"x":-3721636.2583392677,"y":-3387395.9853965403,"z":3905484.2649915754},{"x":-4114116.6922923024,"y":-4364787.286870347,"z":2161439.7161563924},{"x":-5049329.061953449,"y":-3873854.1936180294,"z":420676.3863324758},{"x":-5978446.167712633,"y":-2201859.6735957423,"z":-300033.82613763906},{"x":-6355767.250268093,"y":-326638.8674350246,"z":420676.38633247546},{"x":-5962391.688646079,"y":653612.7053441638,"z":2161439.716156392},{"x":-5029715.83629673,"y":164276.00972749802,"z":3905484.2649915745},{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851}]},

            material : Cesium.Color.RED.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

Sandcastle.addToolbarButton('Combined Rings', function() {
    viewer.entities.removeAll();
    var ring = viewer.entities.add({
        polygon : {
            "hierarchy":{"positions":[{"x":1757344.1780213583,"y":647229.2581826366,"z":6076562.679864116},{"x":2652901.294209005,"y":-3818081.9914601683,"z":4351708.617454816},{"x":1708391.4177992684,"y":-6141499.230329198,"z":209100.18642667998},{"x":-518882.85347091674,"y":-4984862.003384907,"z":-3931712.274062728},{"x":-2734028.806781344,"y":-1006941.8720557253,"z":-5654757.474178011},{"x":-3628199.327763546,"y":3457493.058045505,"z":-3931712.2740627294},{"x":-2683204.532055827,"y":5782475.894605995,"z":209100.18642667856},{"x":-457314.81430675916,"y":4626715.739154917,"z":4351708.617454815},{"x":1757344.178021357,"y":647229.2581826397,"z":6076562.679864116}],"holes":[{"positions":[{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851},{"x":-3721636.2583392677,"y":-3387395.9853965403,"z":3905484.2649915754},{"x":-4114116.6922923024,"y":-4364787.286870347,"z":2161439.7161563924},{"x":-5049329.061953449,"y":-3873854.1936180294,"z":420676.3863324758},{"x":-5978446.167712633,"y":-2201859.6735957423,"z":-300033.82613763906},{"x":-6355767.250268093,"y":-326638.8674350246,"z":420676.38633247546},{"x":-5962391.688646079,"y":653612.7053441638,"z":2161439.716156392},{"x":-5029715.83629673,"y":164276.00972749802,"z":3905484.2649915745},{"x":-4101494.5335213183,"y":-1510579.0303183785,"z":4629479.853831851}]}]},

            material : Cesium.Color.ORANGE.withAlpha(0.5),
            outline : false,
            outlineColor : Cesium.Color.BLACK
        }
    });
});

viewer.zoomTo(viewer.entities);

This is a known problem with very large polygons, I’ve added your example to this issue: https://github.com/AnalyticalGraphicsInc/cesium/issues/2788

I don’t have an ETA for you but we’ll try to remember to respond to this post when a fix is available.

FYI, this issue has been fixed and will be part of Cesium 1.23 on July 1st. See https://github.com/AnalyticalGraphicsInc/cesium/pull/3998 for details.