A way only lists node IDs. Older tools and the OSM XML format expect the nodes to be in the answer too. > (recurse down) adds them.
The query
[out:json][timeout:25]; area["name"="Zürich"]["admin_level"="8"]->.a; way["highway"]["name"="Langstrasse"](area.a); (._;>;); out;
Run it
Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).
How it works
._is the current set: the ways of the street.>adds their nodes (and, for relations, their members).- The union
(._;>;);keeps both, andout;prints ways and nodes.
Variations
out geom;is simpler when you only need coordinates: it puts them directly on the way.<recurses up: from nodes to the ways and relations that use them.
Run it from your code
curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
--data-urlencode 'data@query.overpassql'
import requests
query = open("query.overpassql").read()
r = requests.post("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter",
data={"data": query}, timeout=120)
r.raise_for_status()
print(r.json()["elements"][:3])
const res = await fetch("https://api.overpass.ch/v1/YOUR_API_KEY/interpreter", {
method: "POST",
body: new URLSearchParams({ data: query }),
});
if (!res.ok) throw new Error(await res.text());
console.log(await res.json());
Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.