Is there a way to get the height above sea level at a given coordinate? Or the elevation at a given spot on terrain?
I currently do a raycast, get hit coordinates, and call this function: lonLatHeight = CesiumWgs84Ellipsoid.EarthCenteredEarthFixedToLongitudeLatitudeHeight(hitCoordinates);
But the height value doesn’t seem to return height above Sea Level. And seems to dramatically change when zooming out from the earth. Maybe because the terrain is not fully loaded in?
Basically I want to know the elevation of a specific point on earth, even if zoomed way out from the earth… Any ideas?
Cesium for Unity uses the WGS84 ellipsoid model, so the Height of a point actually refers to the height above that ellipsoid. This previous forum thread is similar to your concern and might be helpful:
There is some information later in the thread that explains how you might convert from WGS84 height to mean sea level. Let us know if you have any follow-up questions or concerns!
@5DRealities Hi and
may be I can help you - I worked as frontend for web app - BUT as I see documentation very similar and use one core - may be this can be work for you also
there are 2 answers:
1 for a regular simple option without a height map - for a simple spheroid - when deleting the globe, the geometry grid is optimized by the LOD type - imagine that at a large distance this can be a sphera with a division of say 16 for very large distances - thus visually it is not noticeable BUT if you consider it relative to the real position for geography - it will be hundreds and thousands of meters of deviation (in addition, a real geoid is very different from a sphere and differences on our planet from the ideal sea level can be tens of meters both higher and lower even in the ocean (it seems there is a depression in the Indian Ocean and a hill in the North Atlantic))
2 for the option with using a height map - that is, a geoid - it more accurate than a spheroid - you can get a more real height using the method
Thanks for you work on this issue! Much appreciated. I saw in the recent Unity update “Added SampleHeightMostDetailed method to Cesium3DTileset . It asynchronously queries the height of a tileset at a list of positions.”
But I am still confused how to implement it in Unity C#. How do I use this method at one point to get the height of the terrain? Is there a C# code example anywhere?
I do not see the SampleHeightMostDetailed method under Cesium3DTileset in the latest v1.13.0 update like the change log suggest.
How do I use this method at one point to get the height of the terrain? Is there a C# code example anywhere?
Janine added a nice example of how to do height queries from a Unity coroutine to the PR that added the feature:
I do not see the SampleHeightMostDetailed method under Cesium3DTileset in the latest v1.13.0 update like the change log suggest.
I don’t know why that would be. I just double-checked that yesterday’s v1.13.0 release includes it. Please make sure you’re not accidentally still on v1.12.0 somehow.
Yes, I’ve installed the latest 1.13.0 from package manager and still not seeing the new methods. I tried pasting some of the code example in and visual studio is giving me errors.
I get errors on CesiumSampleHeightResult and terrain.SampleHeightMostDetailed. Those objects can’t be found… perhaps you can try installing from package manager and see if you are seeing the same thing?