# WGS84 to MSL and opposite

I am using CesiumJS to create point in a map using World Terrain to get the elevation of my points.

The point in Cesium are using `WSG84`. When I calculate the altitude using sampleTerrain I retrieve an `height above the reference ellipsoid`

To convert that height to MSL, I have seen on Internet Here or Here that require a geoid to compute the conversion from WGS84 point to MSL.

The geoid height above the ellipsoid (N) is the difference between the ellipsoidal height and orthometric (geoid) height.

N = He − Ho

Where:

N = geoid height above the ellipsoid He = ellipsoidal height Ho = orthometric (geoid) height

I am using a package that calculate a geoid using EGM2008 for a given long/lat.

So I dispose of :

• A Point `A` in WSG84 with an height above the ellipsoid
• A Point `B` in EGM2008 with a geoid height

I tried to do `MSL = A - B` but my value are always wrong.

I used those two calculator :

When using those two tools, when I do `GPS - GEOID = MSL` it does work, but the value I get from Cesium are not the same (Isn't GPS using WSG84 ? )

`````` GPS  |  CESIUM       | GEOID      |  DIFF (GPS / CESIUM)

669   | 705           | 49.421     | +36
52    | 88            | 37.162     | +36
51    | 36            | -15.992    | -15
0     | -86           | -98        | +86
``````

So my question is : Using `Cesium World Terrain` and apparently `WSG84 altitude above an ellipsoid`, how do I retrieve the altitude of the point in MSL?

• I believe you want a geoid not a geoID. I can't speak for your API but you will want a transformation from MSL to ellipsoidal heights and that will be based on your area.. as Japan is geoactive some parts will move in different direction and/or magnitude to others which further complicates the issue. Transformations can be parametric or displacement grid, have a search of the Japan mapping agency to find a geoid adjustment model then run that in reverse to find your ellipsoidal height. Jun 27, 2019 at 3:06
• I'm not that familiar with Cesium, but looking at their website, it seems like their world terrain would provide a way to convert altitude to elevation. Nov 18, 2019 at 19:52
• @KirkKuykendall I thought I found a solution, but 3 days ago I got a feedback that apparently my way was wrong. I asked Cesium directly and I am waiting for updates atm. Nov 19, 2019 at 4:04
• How are you getting the values for the "GPS" column? Nov 19, 2019 at 15:21
• @GabrielDeLuca with the daftlogic website Nov 20, 2019 at 0:00

I think there is a problem with the way you are thinking about the whole thing.

To sum up: You use Cesium points which are from a Digital Elevation Model. Those points are expressed in WGS84 and the height representation is ellipsoidal height

GPS gives you height which is ellipsoidal height

You have geoid height from the EGM2008 model

So when you compare CESIUM points with GPS points measured near the ground surface, you should have the same height. This is not the case and your GPS data seems to look like altitude. So you should look at your GPS computation (according to the software you use, it might give you coordinates height in altitude if it's compute its background) and at the ellipsoid you choose for you "Cartographic" object in Cesium, it might not be WGS84

From one of those two data, you can get the geoid height (which is an altitude) with the formula Ho = He - N where N is the geoid height above ellipsoid given by EGM2008 for example

One other thing, you use data with a lot of accuracy difference and resolution difference:

• The accuracy of the EGM2008 is at 5 centimeters on the sea and 50 centimeters on the grounds and it has a bad spatial resolution (near 10km).

• For CESIUM, the spatial resolution goes from 2 to 30 meters. I didn't find any information about the accuracy but according to the data source of the DEM, I would say that the accuracy is near 1 meter.

• The accuracy of your GPS data can vary from a few centimeters to a few meters according to your computation mode (Basic, differential, PPP, etc...)

• Thanks for that detailed reply. I am still a bit confused, with all those altitude tho. GPS is using WGS84, height above an ellipsoid Cesium is using WGS84, height above an ellipsoid. So to me they should have near the same altitude on the ground (but the difference is to big to be just conversion mistakes), So from ulterior test I believe having found the problem github.com/AnalyticalGraphicsInc/cesium/issues/8414 To me it looks like Cesium is giving me a sum of geoid + altitude (where the gps only give me altitude) but I would like to confirm with the repo owners first. Nov 25, 2019 at 10:52
• You seem to be in the good way. The issue you find looks like your problem yes! The rest can only be explain be the repo owners Nov 25, 2019 at 11:00
• well, you can't really answer, so I give you the bounty for the reply, thanks. Nov 25, 2019 at 11:04

First: Hulecom's points are absolutely valid and I think it is the answer to your question.

I had somewhat a similar case and here is how I solved it:

1. I created a flat terrain data in QGIS and export it as GeoTIFF.
2. I imported the GeoTIFF containing the flat terrain data into CESIUM ion (see screenshot below), pay attention to the proper selection of WGS84 vs EGM96.
3. Knowing the elevation of the GeoTIFF, I was able to match objects in Cesium to the surface of the flat terrain data in the GeoTIFF.

Hope that helps. Good luck!

Screenshot: