QGIS Processing – How to Merge Several .hgt Files into One

landsatlatitude longitudeqgis-processingsrtmterrain

I'm currently struggling on trying to combine several .hgt files with different software. I can get the 4 tiles into any kind of software but my issue is exporting the file back to .hgt file.

I've tried using VTBuilder, which allowed me to easily blend the 4 tiles together. I made sure the projection was indeed to WGS 84 and the column and rows were at 1201 as a SRTM should be (as I have got 4 together perhaps I should have double them to 2402×2402?).

I then exported the data as .bt file from VTBuilder and imported it into Landserf, having seen information that it could write .hgt, which doesn't seem to be the case. I supposedly found a workaround by saving the file as a .bil and changing the file name manually to .hgt… It doesn't work as it should.

To give you all the context, I am working with grasshopper using the plugin elk. The grasshopper component cannot read 4x .hgt files and is asking for only one file larger than the area I am looking at ( which is 24.6420 to 25.1627; 94.8683 to 95.2968) hence why I am trying to combine them all together. I have access to QGIS and the software mentioned before.

I cannot seem to find anybody that has raised this issue before on the forum or online for that matter.

Best Answer

(Perhaps grasshopper/elk also accepts IMG and GeoTiff formats, anyway...)

Not a QGIS answer; my choice is SAGA, currently version 7.

  1. Install and Start SAGA

Mosaicking

  1. Drag and drop your hgt files to SAGA window.
  2. In the Tools window, go to Grid > Tools and activate Mosaicking tool.
  3. Mosaicking window has an entry for input files, as >>Grids. Click [...] button and select all your grids. [Edit] Choose Nearest Neighbour for resampling method. Then click on [Apply] button and then [Execute]. You'll have newly merged raster (grid).

Export hgt

  1. Then export the new grid as hgt. In the Tools window, go to Import/Export > GDAL/OGR and activate Export Raster tool.
  2. [Edit] Choose newly created Grid System (usualy 2401x, 2401y for 2x2 mosaic), then select new grid in the >>Grid(s). Give a new filename in File (file extension should be .hgt. In the Format selection, choose ESRI.hdr Labelled as the output format. Then click on [Apply] button and then [Execute] button. Now you have merged hgt file.

In this export process, SAGA is using a GDAL driver for ESRI BIL format. This is sometimes tricky (depends on data), but would work in most cases.