Overpass query example

Changes in an area between two dates (adiff)

An augmented diff lists what was added, changed or deleted between two dates, with the old and the new version. Example: Paradeplatz, Zürich, late 2024.

History queries are part of the Medium and Large plans. The result below runs on our server for this page.

[adiff:…] runs the query at two dates and compares the answers. The result lists what was added, what changed and what was deleted; a changed element comes with its old and its new version.

This query lists the changes around Paradeplatz in Zürich between 1 October 2024 and 1 January 2025. Diffs are available in XML only: with [out:json], Overpass refuses the query.

The query

[out:xml][timeout:60][adiff:"2024-10-01T00:00:00Z","2025-01-01T00:00:00Z"];
nw(47.370,8.538,47.372,8.542)(if:count_tags()>0);
out meta geom;

Run it

Running the query…

Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).

How it works

  1. [adiff:"2024-10-01T00:00:00Z","2025-01-01T00:00:00Z"] gives the two dates. With one date, Overpass compares it with the current data.
  2. (if:count_tags()>0) leaves out the untagged nodes of ways. When such a node moves, the way shows up as changed, sometimes with the same version number.
  3. out meta geom; prints each version with its tags, coordinates, version number, time and user.
  4. Each change is an <action>: create for what was added, modify with an <old> and a <new> version, delete for what is gone. A deleted object has visible="false" in <new>; without it, the object still exists and no longer matches the query.
  5. Most rows come from edits of the tram tracks on 11 November 2024: moved nodes and the ways that use them. Outdoor seating was added at four places, and the Junobrunnen fountain was redrawn: its point lost its tags and a new outline took its place.

Variations

  • [diff:…] gives the same changes without the new version of what is gone, so it cannot tell a deleted object from one that no longer matches.
  • Only what was added or deleted: add compare(delta:id()); before out, as in deleted objects in an area.
  • With relations (nwr instead of nw) this query took ten times as long, and the answer was 20 times larger.
  • To follow the edits in an area, run it every day with the day before as the only date.

Run it from your code

curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
  --data-urlencode 'data@query.overpassql'

Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.

More examples

All examples →