timeline returns one entry per version of an element, with the time it was created and replaced. retro runs statements at another date. Together they give every version with its tags.
This query lists the versions of the node of the Matterhorn summit.
The query
[out:json][timeout:60];
timeline(node, 26863664);
for (t["created"]) {
retro (_.val) {
node(26863664);
out meta;
}
}
Run it
Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).
How it works
timeline(node, 26863664)makes onetimelineelement per version, with the tagsrefversion,createdandexpired.for (t["created"])loops over the versions;_.valis the time the version was created.retro (_.val) { … }runs the block at that time, sonode(26863664)returns the version of that moment.out meta;prints it with its version number, time, user and changeset.- The history starts with the version that was current on 12 September 2012, here version 16 of 2011. Since then, the name changed to Cervino in 2015 and back two weeks later, and in July and August 2023 the Russian name was removed and added back nine times.
Variations
- Only the list of versions:
timeline(node, 26863664); out;is small and fast. - Who edited it last:
node(26863664); out meta;. - Ways and relations work the same:
timeline(way, …)andtimeline(relation, …). The ID is in the address of the object on openstreetmap.org.
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.