With elevation=1 every station gets the height of the terrain at its position. Sorted, that gives the highest stations of a country.
The elevation model describes the ground surface, so a station in a tunnel gets the height of the mountain above it. Eigerwand, a station inside the north face of the Eiger at 2,866 m, reads about 3,170 m.
The query
[out:json][timeout:90]; area["ISO3166-1"="CH"][admin_level=2]->.ch; nwr["railway"="station"](area.ch); out center;
Run it
Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL). Heights produced using Copernicus WorldDEM™-90 © DLR e.V. 2010-2014 and © Airbus Defence and Space GmbH 2014-2018 provided under COPERNICUS by the European Union and ESA; all rights reserved. Sea depths: GEBCO Compilation Group (2026) GEBCO 2026 Grid.
How it works
nwr["railway"="station"]finds stations of every railway, including rack railways and funiculars tagged as stations.out center;gives one point per station, andelevation=1anelevationfor each.- For the more than 1,100 stations with an
eletag, the median difference is below 1 m. - Underground stations are the exception. Jungfraujoch, at 3,454 m the highest railway station in Europe, lies inside the rock and reads about 30 m high.
Variations
- To leave out tunnel stations, skip those with
location=undergroundor a negativelayer, or preferelewhere it exists. - Halts too:
nwr["railway"~"^(station|halt)$"]. Without heights: train stations in a country.
Run it from your code
The query is unchanged; elevation=1 in the URL adds the heights. Each height uses one lookup from your elevation allowance.
curl 'https://api.overpass.ch/v1/YOUR_API_KEY/interpreter?elevation=1' \
--data-urlencode 'data@query.overpassql'
import requests
query = open("query.overpassql").read()
r = requests.post("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter",
params={"elevation": 1}, data={"data": query}, timeout=120)
r.raise_for_status()
for el in r.json()["elements"]:
height = el.get("elevation") or el.get("center", {}).get("elevation")
print(el.get("tags", {}).get("name"), height)
const res = await fetch("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter?elevation=1", {
method: "POST",
body: new URLSearchParams({ data: query }),
});
if (!res.ok) throw new Error(await res.text());
const { elements } = await res.json();
for (const el of elements) console.log(el.tags?.name, el.elevation ?? el.center?.elevation);
Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.