Get elevation between 2 points on map

Is there a way that I can get the elevation between 2 points on the map? When I select the 2 points I draw a line between the 2 location but I need to find all the elevations between the 2 location on that line.

Does Cesium has a function that I can get that information?

Thanks,

Given one or more positions, you can use Cesium.sampleTerrainMostDetailed to query the terrain heights at those locations.

There’s a code example on this here: https://sandcastle.cesium.com/index.html?src=Terrain.html. Click “sample most detailed terrain”, which will get the heights in a grid.

The “sample line positions” drop-down in this example does a similar thing but along a line instead: https://sandcastle.cesium.com/index.html?src=Clamp%20to%20Terrain.html.

What kind of project are you working on?

@Omar thanks for the reply. I will take a look here at the links you sent.