2D Draw tools entities are not visible if 3D terrain is On

Hi all,
I’m using 2D draw tools to draw many entities like a point, line, and polygon it’s working fine when the terrain is off(on 2D images) but when I open the 3D terrain it’s become invisible. I want a solution for how to be visible on 3D terrain also.
Thanks in advance.
Regards
Shashi

Hello @Shashi,

Cesium does support drawing points, lines, and polygons on terrain, but you have to make sure you’re setting the correct options when you’re creating the entities. See Cesium Sandcastle for an example

Best regards,

Hannah

1 Like

Dear Hannah,
I’m trying to show points on click event using billboard it’s working fine but when i’m using "heightReference: Cesium.HeightReference.CLAMP_TO_GROUND" to make it visible on terrain it’s throwing error given below:-


all code snipped is here:
toolbar.addListener(‘markerCreated’, function (event) {
loggingMessage('Marker created at ’ + event.position.toString());
// create one common billboard collection for all billboards
var b = new Cesium.BillboardCollection();
scene.primitives.add(b);
var billboard = b.add({
show: true,
position: event.position,
pixelOffset: new Cesium.Cartesian2(0, 0),
eyeOffset: new Cesium.Cartesian3(0.0, 0.0, 0.0),
horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
verticalOrigin: Cesium.VerticalOrigin.CENTER,

            scale: 1.0,
            image: 'assets/icon/icons8-marker-24.png',
            heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, 
            color: new Cesium.Color(1.0, 1.0, 1.0, 1.0)
        });
        billboard.setEditable();   

    });

but if i’m using default its working fine code snippet is here:

text: “Draw Billboard”,
onselect: function () {
var e = viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
billboard: {
image: “…/images/facility.gif”,
heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
},
});
viewer.trackedEntity = e;
},

if i’m using RELATIVE_TO_GROUND then error is not throwing but it not visible on my terrain.
Note:- The terrain does not belongs to the cesium.
Best Regards
Shashi

You need to pass the scene to your BillboardCollection: BillboardCollection - Cesium Documentation

If you use CesiumUnminified/Cesium.js during development, you will get more useful error messages.

-Hannah

1 Like

Thank you so much.