z-ordering not working in 2D

45 views
Skip to first unread message

Sandra Velez

unread,
Oct 2, 2019, 7:47:05 AM10/2/19
to cesium-dev
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');

viewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(-111.0, 40.0),
    name : 'Ellipse',
    ellipse : {
        semiMinorAxis : 250000.0,
        semiMajorAxis : 250000.0,
        material : Cesium.Color.CORNFLOWERBLUE,
        zIndex: 10
    }
});

viewer.entities.add({
    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
    }
});

viewer.entities.add({
        position : Cesium.Cartesian3.fromDegrees(-125.0, 40.0),
        label : {
            text : 'Demo',
            backgroundColor: Cesium.Color.GRAY,
            showBackground: true,
            eyeOffset: new Cesium.Cartesian3(0, 0, -50)
        }
    });


viewer.zoomTo(viewer.entities); 

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

Cesium Demo.png

sandy...@gmail.com

unread,
Oct 10, 2019, 12:41:33 PM10/10/19
to cesium-dev
Has anyone been able to confirm this issue?

Thanks!

Omar Shehata

unread,
Oct 17, 2019, 9:47:28 PM10/17/19
to cesium-dev
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.
Reply all
Reply to author
Forward
0 new messages