Getting polylines to lie flat.

I have been trying to have a collection of polylines lie flat on a terrain but get almost vertical renderings.
poly2.jpg is what I am seeing, poly0.jpg are typical endpoints of a polyline, and what I think is the relevant code is:

this_viewer.entities.add({

 **                          polyline :{
                            positions : this_Cesium.Cartesian3.fromDegreesArrayHeights(
                              [block_edgepoints_llh[i][0], block_edgepoints_llh[i][1], block_edgepoints_llh[i][2],
                              block_edgepoints_llh[i+1][0], block_edgepoints_llh[i+1][1], block_edgepoints_llh[i+1][2]
                              ]),
                           width : 40,
                           followSurface : true,
                           material : this_Cesium.Color.GREEN
                           }
                            });**

I tried various things such as **followSurface: false**     but to no avail. I checked the documentation but could see nothing there as well. Is there a control I am missing?

poly2.jpg

poly0.jpg

Hello Jerry,

Your code looks like it should work. Do you have more sample data I could test with?

Thanks,

Hannah

Hi Hannah,

Thanks. I stripped my code down to http://vcities.ite-stl.org/Cesium/Apps/Sandcastle/gallery/polylinetest.html . When you open it you see the block I am working with. Fix Corner Heights runs the relevant code. I realized after the fact that the button is misnamed but I just left it.

I had moved all my terrain height fix code to blockmath.js I just left it there but attached both files.

Jerry

blockmath.js (7.46 KB)

polylinetest.html (5.72 KB)

Thanks Jerry. Unfortunately, I don’t think you can use polylines to accomplish what you want to do. They’re drawn such that they have the same pixel width on the screen regardless of the camera distance. They are appearing jagged because parts of the line are getting rendered under the terrain from certain camera angles.

We are working on getting a polygons on terrain feature in. You can see the progress here: https://github.com/AnalyticalGraphicsInc/cesium/pull/2865

Dan is making really good progress and it should be ready soon.

In the mean time, you could try using the perPositionHeight option on your polygon. You could specify a height for each position along the perimeter.

Here is an example:

var orangePolygon = viewer.entities.add({

name : ‘Orange polygon with per-position heights and outline’,

polygon : {

hierarchy : Cesium.Cartesian3.fromDegreesArrayHeights([-108.0, 25.0, 100000,

-100.0, 25.0, 100000,

-100.0, 30.0, 100000,

-108.0, 30.0, 300000]),

perPositionHeight : true,

material : Cesium.Color.ORANGE.withAlpha(0.5),

outline : true,

outlineColor : Cesium.Color.BLACK

}

});

``

-Hannah

Hannah,
In fact, that is exactly what I was looking for.

Much thanks, yet again.

Jerry

Hannah,
I wanted to thank you again and show you where I am, which is where I want to be. I picked a block with very few building.

Jerry

Looks great! I’m glad that worked out for you.
Your project is really interesting, I can’t wait to see it when it’s finished.

-Hannah