HGT — SRTM elevation tile format: Earth's terrain in 1°×1° chunks

2026-06-0910 min read
HGTSRTMelevationterrainDEMNASA

HGT (Height) is the native file format for elevation data from SRTM (Shuttle Radar Topography Mission), a 2000 NASA-NIMA mission that measured the topography of 80% of Earth's landmass from orbit aboard the Space Shuttle Endeavour over 11 days. SRTM remains the most complete publicly available global elevation database. Each HGT file covers a 1°×1° square of Earth's surface and contains a 1201×1201 (SRTM3, 90 m step) or 3601×3601 (SRTM1, 30 m step) grid of 16-bit signed integer elevation values in meters above sea level. No header, no metadata in the file — just a raw int16 array. For anyone building a topographic map of a hiking trail or a 3D terrain visualization, HGT is the starting point.

Map generation of Sochi city center
Sochi center, 200×200 m fragment. An OSM city plan from osm2cdr.ru over HGT N43E039 elevation tile yields a topographic atlas of the Caucasus coast.

History: 11 days in orbit, a quarter century in the public domain

In February 2000 Space Shuttle Endeavour STS-99 spent 11 days in orbit, deploying a 60-meter mast with two radar antennas — C-band and X-band. Radar interferometry simultaneously from two viewpoints gave NASA and the US National Imagery and Mapping Agency (NIMA) the ability to measure Earth's surface elevation at every point between 60°N and 56°S — 80% of the planet's landmass. The mission was called Shuttle Radar Topography Mission, SRTM.

The data was initially classified. In 2003 NASA published SRTM3 — a version with a 3-arcsecond step (approximately 90 m at the equator) for all zones except the US. The US was available only as SRTM1 (1 arcsecond, 30 m) under NDA. In 2014 Barack Obama signed a declassification directive, and SRTM1 became freely available for the entire planet — still the largest open-data release in geospatial history.

In parallel SRTM data became the foundation for many derivative products: ASTER GDEM (Japan-USA, 30 m), ALOS World 3D (Japan, 30 m), Copernicus DEM GLO-30 (ESA, 30 m, better quality than SRTM). But the HGT format remained the standard container — simple, compact, no parser more complex than numpy.fromfile required.

Today HGT is used by OsmAnd, Locus Map, Komoot, AllTrails, QGIS, ArcGIS, Garmin BaseCamp. In 2024 NASA released SRTM Plus — an updated version with improved void handling (areas without data in high mountains and deserts). The files are still HGT.

What's inside an HGT file

HGT is simply a raw int16 array (signed 16-bit big-endian) without a header. File size is fully determined by one of two conventions:

  • SRTM1: 3601 × 3601 × 2 bytes = 25,934,402 bytes ≈ 24.7 MB per tile
  • SRTM3: 1201 × 1201 × 2 bytes = 2,884,802 bytes ≈ 2.7 MB per tile

The filename encodes the geographic position of the square's corner: N43E039.hgt means the lower-left (southwest) corner is at latitude 43° north of the equator and longitude 39° east of Greenwich. S33W071.hgt is in southern Chile. This lets programs automatically determine geolocation without reading the file.

Inside, values go row by row from north to south (the first row is the northernmost), in each row from west to east. The value -32768 (minimum int16) denotes a void — a data hole where the radar received no return (water, sand deserts, steep slopes). Elevation is encoded in meters: 1500 = 1500 m above sea level. Negative values are valid too — depressions below sea level (the Dead Sea ≈ -430 m).

Big-endian byte order is a legacy of NASA's origins: in 2000 x86 hadn't yet become dominant, and NASA's Sun/SGI workstations ran big-endian. Today all x86/ARM are little-endian, so reading HGT in Python requires dtype='>i2' (big-endian signed 16-bit):

import numpy as np
data = np.fromfile('N43E039.hgt', dtype='>i2').reshape((1201, 1201))
print(f"max altitude: {data.max()} m at row {np.unravel_index(data.argmax(), data.shape)}")

Who needs HGT: five roles

Hiker and trail runner. OsmAnd, Komoot, AllTrails, Locus Map store elevation data as HGT inside their APKs or offline packages. When a user downloads an offline regional map — HGT tiles for that region are bundled. Route elevation profile, ascent/descent in the tracker, time-on-trail prediction based on slope — all of this is computed from HGT at route-build time.

Topographic atlas cartographer. Production of a printed topomap typically begins with contour lines and hillshade. GDAL generates both products from HGT with one command. Contours and hillshade are then overlaid with an OSM export from osm2cdr.ru — roads, hydrography, settlements. The result is a topographic atlas in the style of 1980s Soviet Geodesic Survey, only on open data.

Road project engineer. Before starting road or infrastructure projects, an engineer needs a rough terrain assessment over 100×100 km. HGT provides primary analysis of longitudinal slopes, search for problem zones with >8% gradients, ballpark cut/fill volumes. Not a replacement for laser scanning, but a first approximation in an hour of work.

3D terrain visualization in Blender/Houdini. HGT converts to a displacement map (16-bit grayscale PNG) with a single gdal_translate command. The resulting heightmap loads as a displacement texture on a plane, and Blender builds the 3D relief of a city or mountain range. On top — an OSM texture as diffuse map. Many Blender 3D-map tutorials begin exactly here.

Geophysicist and climatologist. Elevation is a fundamental variable for atmospheric circulation models, solar radiation calculations, flood forecasting. ESA Copernicus Climate Data Store accepts SRTM HGT directly as one source. Scientists batch-process thousands of HGT tiles through xarray + rasterio.

Software for HGT: seven programs

GDAL/OGR. Universal tool. gdalinfo N43E039.hgt shows metadata, gdal_translate converts to GeoTIFF, PNG, ASCII Grid. gdalwarp reprojects and mosaics tiles. Free, via apt/brew/conda. gdal.org

QGIS. One of the most popular open-source GIS. Drag-and-drop an HGT file into QGIS — and you see the elevation field, can apply a hillshade style, generate contour lines. Free. qgis.org

ArcGIS Pro. Paid enterprise GIS from Esri. HGT is supported via ESRI Add-in or universal GDAL plugin. Used in government and major commercial projects. esri.com/arcgis

Python: rasterio + numpy. Most flexible path for scripts. rasterio.open('N43E039.hgt') reads HGT with automatic CRS detection (WGS84 geographic), numpy processes the array. The default tool for serious batch processing. rasterio.readthedocs.io

MicroDEM. Free, Windows. Old but still active tool for terrain analysis: contour lines, hillshade, viewshed, slope/aspect. Reads HGT natively. Good choice for academic tasks. usna.edu/microdem

SAS.Planet. Free, Windows. Downloads SRTM tiles directly as HGT, mosaics into one file, exports to GeoTIFF. Convenient when you need a 4×4 tile region without manual USGS browsing. sasgis.org

OsmAnd / Locus Map. Not editors but HGT consumers. If you already have tiles — drop them into the app's offline folder and get elevation profiles on any OSM route without internet. osmand.net, locusmap.app

Pitfalls and tips

Voids — data holes. The value -32768 means the SRTM radar couldn't measure that point. Usually dense forests, steep north-facing slopes (radar shadow), large water surfaces. Simply replacing -32768 → 0 creates black pits on hillshade. Correct way — fill via gdal_fillnodata.py or use SRTM Plus (NASA, 2024) with pre-filled voids.

Big-endian byte order. If reading HGT in C/C++, don't forget byte swap. In Python numpy.fromfile(..., dtype='>i2') — big-endian is built into the dtype via the > prefix. GDAL handles it transparently.

Pixel size varies with latitude. At the equator one SRTM3 pixel = 90 meters; at Moscow's latitude (55°N) it's already 90×52 meters (cosine of latitude). Not a format bug but a property of the EPSG:4326 geographic projection. When computing slopes and distances always apply cosine correction or work in a projection (e.g., UTM).

Elevation accuracy ±10–16 m. SRTM3 has RMSE around 10 m on flat terrain, 16 m in mountains. Wholly insufficient for designing buildings or industrial facilities. For serious engineering use Copernicus DEM (4 m RMSE) or ALOS AW3D30 (5 m), or commission a LAS LiDAR survey.

Coordinates are the corner, not the center. N43E039.hgt starts at latitude 43° (SW corner) and extends to 44° (NE corner). Many beginners confuse this with "center coordinate" and end up with a 0.5° (~55 km) offset. Especially critical if you automate tile downloads along a route.

Version 1 vs Version 2 vs Version 3. Over 25 years SRTM has gone through several revisions. V1 (2003) had many voids, V2 (2005) — first void processing, V3 / SRTM Plus (2014–2024) — best quality, plus SRTM1 for the entire planet. Current default is V3.

Coverage. SRTM covers latitudes from 60°N to 56°S. So the Arctic and Antarctica don't exist in SRTM HGT. For polar latitudes use ArcticDEM or Copernicus DEM.

How to use HGT with an OSM export from osm2cdr.ru

osm2cdr.ru is a service for exporting OpenStreetMap vector layers (roads, buildings, hydrography, POIs) to 60+ formats — and elevation in HGT is available right on the site: select an area and order the elevation as HGT. The file is the classic one — a raw big-endian 16-bit array named after its south-west corner — but the heights are not from the 2000 shuttle: they come from the global Copernicus GLO-30 model (~30 m, with GLO-90 where GLO-30 has no coverage). Two caveats: the grid is written over your area, and GDAL reads .hgt as a full-degree tile, so the georeferencing is nominal — irrelevant for a game heightmap or a route profile, but for precise overlay on a map take the original NASA tile as in the steps below. Over the ocean and outside coverage you get a flat tile — honest degradation. And HGT combines perfectly with OSM exports for building a topographic atlas.

Step 1. Download an HGT tile from USGS Earthdata. For example, for Sochi: https://urs.earthdata.nasa.gov/ → SRTM 1 Arc-Second Global → coordinates 43°N 39°E → N43E039.hgt.zip. Unzip.

Step 2. Convert to GeoTIFF with proper georeferencing:

gdal_translate -a_srs EPSG:4326 N43E039.hgt N43E039.tif
gdalwarp -t_srs EPSG:3857 -r bilinear N43E039.tif N43E039_3857.tif

Step 3. Generate hillshade and contours:

gdaldem hillshade N43E039_3857.tif hillshade.tif -z 2 -az 315 -alt 45
gdal_contour -i 10 N43E039_3857.tif contours.shp

Step 4. On osm2cdr.ru outline the same Sochi region and export to PDF, SVG, or PNG.

Step 5. In QGIS open hillshade and contours, add the osm2cdr.ru export on top (as raster or vector layer). Set transparencies — hillshade under the base map, thin brown contour lines on top, OSM layers above. Result — a print-ready topographic atlas of the Caucasus region.

For a trail runner or hiker, simply drop the HGT tile into OsmAnd's offline folder /sdcard/Android/data/net.osmand/files/srtm/ — the app will automatically pick up elevation data on any OSM route.

Sources

← All articles