Get altitude at lat long

Enjoying Cesium for Unreal so far :slight_smile:

I have some (lat, long, alt) points but the alt points are a little noisy. Is there a way to get the height of the terrain? Ideally I’d like to draw on the tiles like:

but just getting access to the height of the terrain would suffice.

Is this possible yet in Cesium for Unreal?

Hi @nhapeman,

Great question. We are currently working on a direct way of querying the height of terrain given lat/long.

However, given your use case, a decal component might be well suited for your use case of drawing on top of the terrain.

If you do need to get the height in the meantime, you could try doing a line trace to the world terrain object and use the Z value. The only issue might be if the fully refined tile is not loaded in when doing the trace, in which case the resulting terrain altitude will either end up being an overestimate or underestimate.

You could work around this by a) doing a new line trace when the camera gets close to the area and more detailed terrain gets loaded in, and adjusting the height of your Unreal object, or b) Temporarily setting the Maximum Screen Space Error in the tileset to a small number, and using the fully-loaded terrain to do the line trace (for example, using a small max SSE at editor time, then once the heights are determined, the value can be set back to normal).

Thanks! I did get ray tracing to work. Had some issues with ray tracing not working when the camera wasn’t looking in the direction I wanted to ray trace but got around it with a minimal caching solution. Should be a good enough solution to last to an update with legit terrain height grabbing.

2 Likes