egm96-universal

A library to convert between EGM96-relative altitudes and WGS84 ellipsoid-relative altitudes

Usage no npm install needed!

<script type="module">
  import egm96Universal from 'https://cdn.skypack.dev/egm96-universal';
</script>

README

egm96-universal

Node.js CI npm Coverage Status

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.

Usage

Installation

npm install egm96-universal

Import

const egm96 = require('egm96-universal')

or

import * as egm96 from 'egm96-universal'

Getting mean sea level according to EGM96

const msl = egm96.meanSeaLevel(latitudeInDegrees, longitudeInDegrees)
// mean sea level in meters relative to the WGS84 ellipsoid

Convert between WGS84 ellipsoid-relative altitude and EGM96-relative altitude

const egm96Alt = egm96.ellipsoidToEgm96(latitude, longitude, altitude)
const ellipsoidAlt = egm96.egm96ToEllipsoid(latitude, longitude, altitude)

Changelog

1.1.0

  • Added Typescript definitions

License

See the license file.

Contributing

See the contribution guide.