Add elevation data to GPX trackpoints using local DEM (Digital Elevation Maps) files or online SRTM (Shuttle Radar Topography Mission) elevation data.
Useful for GPX tracks and routes that are missing elevation, e.g., as exported by some sport watches. The added elevation (approximately) follows the ground level.
SRTM data is captured from space and, thus, relatively coarse and affected by buildings and vegetation. National databases can, depending on location, provide higher resolution and more accurate DEM data but require manual downloads. Higher quality data covering multiple countries is available from, for example, https://viewfinderpanoramas.org/dem3.html.
Easiest way to run is to download the gpelex.py file and use uv:
uv run gpelex.py input.gpx --dem elevation.tif --output output.gpxOr without manually downloading:
uv run https://raw.githubusercontent.com/Aggrathon/gpelex/main/gpelex.py --helpAlternatively, create a Python (>=3.11) environment with rasterio and scipy for local DEM files or srtm.py for online SRTM data.
| Flag | Description |
|---|---|
INPUT |
Path to the input GPX file |
-o, --output FILE |
Output GPX path (defaults to <input>_with_elevation.gpx) |
-d, --dem FILE ... |
One or more DEM files (.tif, .zip, .tar.gz, etc.) |
-f, --force |
Overwrite existing elevation data |
-v, --verbose |
Verbose output (use -vv for per-point details) |
If no --dem files are provided, the tool fetches elevation from the SRTM API (30 m resolution).
Open https://aggrathon.github.io/gpelex in a browser. Select a GPX file and one or more elevation map files (.tif, .zip, .tar.gz), then click Add elevation (after Pyodide has loaded all dependencies). All processing runs locally in your browser — nothing is uploaded.
Alternatively, download gpelex.py and index.html and serve it yourself (requires at least a basic server such as uvx python -m http.server since bare html files are not allowed to read local files).
uvx --with-requirements gpelex.py pytest test_gpelex.py| File | Description |
|---|---|
gpelex.py |
Main script — CLI entry point and library |
index.html |
Browser-based UI running via Pyodide |
test_gpelex.py |
Pytest test suite |