I have the NASA SRTM1 data as .hgt files from their ftp website, but I would have these elevation data in respect to WGS84. I found by NASA's ftp site a folder named srtmOnly that contains what I want, but they have the extension .hgts not .hgt

I found just these infos in readme file

Directory: hgt_srtmOnly

product description: SRTM-only floating point DEM (*.hgts)

product data type: 4-byte real

hgt_srtmOnly contains heights relative to the WGS84 ellipsoid

hgts meters (with value set to -32768 for a void in hgt_srtmOnly hgts files)

I tried to open it with Qgis as raster but it didnt be recognized, also I have a code c++ that converts .hgt file to .csv also doesnt work with these .hgts file.

Does anyone have an idea how to get these data from these .hgts file?

Add This is my cread .hdr file as adviced by @camilo

NROWS 3601
NCOLS 3601
NODATA -32768
XDIM 0.00027777777777778
YDIM 0.00027777777777778

Those .hgts files are in the same general format than the .hgt files, however they contain the elevation data in 4 bytes floating point numbers instead of 2 bytes integers.

Global Mapper won't recognize the .hgts extension. Therefore, when asked about the format of the data you have to choose the option "SRTM (Space Shuttle Topography Mission)".

But unfortunately that's not enough, because of the difference in the data type. Therefore you have to provide a header file (.hdr) that contain some information about how to interpret the data. Thankfully, the .hdr file is just an ascii text file, so you can create or edit it easily.

One way to get a template of the file is to download an standard .hdr file, open it in Global Mapper and then immediately export it in SRTM format. Along with the .hgt file, it will create a .hdr header file.

If you change the extension of the file to .txt and open it in a text editor it will look like this:

LAYOUT         BIL
NROWS          3601
NCOLS          3601
NBANDS         1
NBITS          16
NODATA         -9999
ULXMAP         -50
ULYMAP         1
XDIM           0.00027777777777778
YDIM           0.00027777777777778

To adapt this header to work with hgts files we need to change the number of bits (NBITS) from 16 to 32, the total bytes per row and column from 7202 to 14404, and the NODATA value from -9999 to -32768. Additionally, if you want to use the header for other tiles you can change the latitude and longitude of the upper left corner (ULXMAP and ULYMAP, that in this case is 50° West and 1° North).

In contrast to Global Mapper, QGIS doesn't automatically detect that the data type is float (i.e. decimal numbers), and might don't recognize the extension. To solve those problems you have to add an additional line to the header file:


And you might need to change the data file extensión to .bil (instead of .hgts).

I did a test and my .hdr file ended looking like this:

LAYOUT         BIL
NROWS          3601
NCOLS          3601
NBANDS         1
NBITS          32
NODATA         -32768
ULXMAP         -50
ULYMAP         1
XDIM           0.00027777777777778
YDIM           0.00027777777777778

After those edits, if you rename the file back to .hdr (and optionally change the .hgts extension to just .hgt for Global Mapper or .bil for QGIS). You should be able to load the file without any problem. However, my version of QGIS renders it completely white, and I had to manually adjust the limits of the gray color scale to get it to display properly.

The examples above are for the file n00w050.hgts.zip (South America folder), so instead of exporting to get an .hdr example, it might just work if you copy the text above and paste it in a text file with the same name of the .hgts file, adjust the Lat/Lon of the upper left corner, rename to .hdr and that's it.

There are also scripts to automatically generate the .hdr files, as you see they are quite simple, and write such script wouldn't take much. This newer version of the SRTM (NASADEM), is still in a preliminary release, I describe it in this answer, and there I also mention a script to generate the .hdr files, you can give that script a try, it might solve your problem without messing with the .hdr header files.

  • Thanks a lot for these infos, I can remember your name, I think you answered a question of mine in the past. I have a c++ code that converts .hgt to .csv, I think it is also from you, can I edit it for example to get the data from .hgts file programmatically without any software? – Khaled Jul 17 '18 at 23:02
  • If you want, I would show you the code... it works perfect from .hgt to .csv ;) – Khaled Jul 17 '18 at 23:03
  • You welcome, yes I'm sure the code can be used for hgts files with a little modification. However no specific c++ program or software is needed to transform .hgts files into .csv programmatically. The command line utility hexdump can do the trick if your system endianess is the same of the one of the .hgts file (big-endian). Otherwise, you need to swap the endianness of the file to little-endian and then use hexdump. That endianness tranformation is not that straight forward but can be done with a couple commands. – Camilo Rada Jul 18 '18 at 21:11
  • May I the code show in post as edit?!! – Khaled Jul 18 '18 at 21:13
  • thank you very much, I am still beginner, I tried a lot this day, I wanted to modify the code, but I got horrible results, I searched a lot for 4 Byte Floating point etc.. bcz you answer gave me many infos – Khaled Jul 18 '18 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.