Apologies if I’m missing anything, but can a polygon created via a CZML file be set to drape on terrain? I’ve been able to get points and polylines to work, but setting a CZML polygon’s heightReference to CLAMP_TO_GROUND doesn’t seem to do it.
Hi there,
I believe you’ll need to set the clampToGround
property to true
, as in this example.
Thanks Gabby - everything in that example is a polyline, right? Definitely agree those work, but I’m trying to drape a filled polygon on top of the local terrain.
Hi Rick,
Take a look at the response - Show Sensor Field of View Draped Over a Target - CesiumJS - Cesium Community - which is similar to Gabby’s instructions on setting the clampToGround property to true. The example in the response may provide additional information to help setup your filled polygon.
Thanks - that visual result is exactly what I’m after, but the polygon in that sample is created via direct calls to the Cesium API:
const e = viewer.entities.add({
polygon: {
hierarchy: {
positions: [
new Cesium.Cartesian3(
-2358138.847340281,
-3744072.459541374,
4581158.5714175375
),
.
.
.
I’m looking to get that visual result with a polygon feature created via a CZML file. Do you know of any examples that show that?
Hi Rick,
The information at this link describes how to represent a polygon in czml - Polygon · AnalyticalGraphicsInc/czml-writer Wiki · GitHub.
Here is an example of how it is written in czml.
"polygon":{
"show":true,
"positions":{
"cartographicDegrees":[
39.61385633450027,125.48956824030415,0,
39.61385633450027,125.54785555969585,0,
39.568939605499736,125.54785555969585,0,
39.568939605499736,125.48956824030415,0
]
}
}