draw line at an elevation from ground level

How to draw line at an elevation from ground level?

Have a look at this example

Hi patrick,

I have gone through the example but it is not the actual requirement…

When u look at the line in 3d it should appear at an elevation above ground…

Hi! The orange line in the sandcastle that Patrick included seems to be above the ground. Is that not what you’re trying to do?

Hi again!

The orange line that I mentioned before doesn’t seem to follow the details of the terrain above ground. Here’s a sandcastle that shows a polyline that’s a constant elevation from the terrain and also follows the terrain details. This example is modified from the “Sample line positions” line in Ground Clamping demo.

Main things:

We use Cesium World Terrain when we run, so we include the following in viewer:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

terrainProvider: Cesium.createWorldTerrain()

});

``

The code that elevates the line is the following:

var offset = 1000.0;

for (var i = 0; i < samples.length; ++i) {

samples[i].height += offset;

}

``

We manually increase the heights of every point by an offset.

Hope this helps!

The output i got is below attachment…