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

Do you guys have a release date for the elevation query?

3 Likes

Hi @xuelong , do you have any updates regarding this feature?

2 Likes

Hi,

any progress on this quite useful feature?
Best
Andreas

I agree it is very useful! But we don’t have an update on it at this time.

Just to give an update, as of Cesium for Unreal v2.9.0, you can now use the asynchronous SampleHeightMostDetailed function to query the height on a tileset, at a given longitude / latitude position. This is available in both Blueprints and C++. Remember that this height is returned in meters above the WGS84 ellipsoid!

You can find a Blueprints example in this PR comment: Add Unreal API for terrain height querying by csciguy8 · Pull Request #1421 · CesiumGS/cesium-unreal · GitHub

1 Like