A library to convert between EGM96-relative altitudes and WGS84 ellipsoid-relative altitudes.
Works both in the browser and node.js, you can test the result on the demo page.
It uses the EGM96 sample data file provided by the NGA to lookup reference mean sea level and performs bilinear interpolation on the result.
This library is automatically tested by CI on the reference implementation in Fortran.
This project was initially created to allow usage of KML files (that use EGM96 as reference according to the specification, just like Google Earth) in Cesium. It should work for any similar task that necessitate conversion between the two references.
npm install egm96-universal
const egm96 = require('egm96-universal')
or
import * as egm96 from 'egm96-universal'
const msl = egm96.meanSeaLevel(latitudeInDegrees, longitudeInDegrees)
// mean sea level in meters relative to the WGS84 ellipsoid
const egm96Alt = egm96.ellipsoidToEgm96(latitude, longitude, altitude)
const ellipsoidAlt = egm96.egm96ToEllipsoid(latitude, longitude, altitude)
- Added Typescript definitions