[GIS] How to convert SRTM HGT elevations from WGS84 into meters above sea level

elevationgeoidhgtsrtmwgs84

I am building a JavaScript script that reads binary HGT files – as generated by the SRTM – and converts the data into bitmaps viewable in your browser.

You can try out the script and view the source code of a preliminary version on GitHub:

https://github.com/jaanga/terrain-plus/tree/gh-pages/cookbook/read-hgt-files

The app seems to be reading the elevation data correctly, but the numbers are huge ( over 20>). See the demo which shows the first 50 heights of the file. In this case, the demo shows the southern tip of Point Reyes near San Francisco CA.

The SRTM 'Quickstart Guide' says:

Heights are in meters referenced to the WGS84/EGM96 geoid

I cannot find a definition or explanation for what this exactly means. Nor have I found any JavaScript code that could be used to convert the 16 bit integer HGT data into something like meters of elevation above or below sea level.

Best Answer

From the comment discussion:

There are a range of issues discussed in previous questions:

It is particularly important to note that HGT file format is a pretty raw format, essentially just 16 bit integer values. However reading those values as 16 bit integer values on many machines will treat them as little endian format, while the actual format is big endian.

One option would be to read them as pairs of bytes, and bit shift / add.

Related Question