I want to find the intersection points where a polygon intersects a terrain

Hi there,
Is there any way to find the intersection points where a polygon(having height) intersecting terrain.

The Cesium version you're using, your operating system and browser.
Cesium 1.52, Win 10, Chrome

1 Like

Computationally this might be expensive since I think you’d need to sample enough terrain heights in the area covered by the polygon, figure out what parts of it are above/under terrain, then do some kind of binary search to narrow the exact point (or sample all the terrain heights in the polygon and iterate over them if it’s a small enough area). Terrain height can be sampled with this function:


I had gone through the sampleTerrainMostDetailed, as said terrain heights can be sampled.

But Can you please provide me a way to sample all the points in the polygon/rectangle so that by passing the points to sampleTerrainMostDetailed would return terrain heights.


It seems to me that what you want to do is known in GIS as a drape of the polygon on terrain. You can do it with any GIS package: QGIS, GRASS, SAGA, ArcMap, PostGIS…

You can in fact drape polygons, textured or otherwise, on terrain in CesiumJS! See the “draw textured polygon” option in this example: