Polygon with vertices above Earth

I am using CZML for rendering shapes. There is a need to draw a polygon, triangle to be specific, where 2 of the vertices are on the Eart’s surface and the third has an altitude. When processing the CZML, the third vertex is projected on the Earth’s surface… further looking at the CZML Content page, “A polygon, which is a closed figure on the surface of the Earth.” (doh!)

Is there a way to draw polygons with vertices above the Earth’s surface?

Hello,

Yes, there are two different ways to accomplish this. You can either specify a height for the entire polygon, or have heights for each position and set perPositionHeight to true.

Here’s an example of both in Sandcastle:

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

var perPosHeight = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArrayHeights([-115.0, 37.0, 100000.0,
-115.0, 32.0, 100000.0,
-107.0, 33.0, 0,
-102.0, 31.0, 100000.0,
-102.0, 35.0, 100000.0 ]),
perPositionHeight: true,
material : Cesium.Color.RED
}
});

var constantHeight = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 47.0,
-115.0, 42.0,
-107.0, 43.0,
-102.0, 41.0,
-102.0, 45.0 ]),
height: 100000,
material : Cesium.Color.BLUE
}
});

viewer.zoomTo(viewer.entities);

``

There is information for using these properties in CZML in the CZML content page polygon documentation.

Best,

Hannah