z-ordering not working in 2D

1. A concise explanation of the problem you’re experiencing.

I am trying to draw routes with waypoints (billboards or ellipses) and labels on top of a polyline. In 2D, the line sometimes shows on top of the waypoints and sometimes below. I need to show the waypoints on top of the line every time.Using Cesium 1.61. I have attached a screen capture of what I see.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

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


position: Cesium.Cartesian3.fromDegrees(-111.0, 40.0),

name : ‘Ellipse’,

ellipse : {

semiMinorAxis : 250000.0,

semiMajorAxis : 250000.0,

material : Cesium.Color.CORNFLOWERBLUE,

zIndex: 10




name : ‘Polyline’,

polyline : {

positions : Cesium.Cartesian3.fromDegreesArray([-100, 40, -125, 40]),

width : 3,

material : Cesium.Color.BLUEVIOLET,

clampToGround : true,

zIndex: 0,

arcType : Cesium.ArcType.RHUMB




position : Cesium.Cartesian3.fromDegrees(-125.0, 40.0),

label : {

text : ‘Demo’,

backgroundColor: Cesium.Color.GRAY,

showBackground: true,

eyeOffset: new Cesium.Cartesian3(0, 0, -50)




3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

Trying to draw vehicle routes with waypoints and labels. Route (polyline) should be on the bottom and labels should be on top of everything

4. The Cesium version you’re using, your operating system and browser.

Using Cesium 1.61, Win10, Chrome

Has anyone been able to confirm this issue?


I think this is a bug. I was able to reproduce it in the official Z-indexing Sandcastle example by putting the polyline to the bottom, and switching to 2D makes it display on top again. I opened a bug report here:

Thanks for reporting this and for the Sandcastle example reproducing this issue.