Hi,
I try to find deleted or changed objects (nodes, ways and relations) e.g. deleted amenity=restaurant or changed amenity=restaurant to shop, cafe or post office after 2018.(query with {{bbox}}
).
I tried different queries but with no results.
Could you post a link to an example query?
I tried this query, but it finds all restaurants. I try to find restaurants, that are deleted or are no longer with tag amenity=restaurant.
[out:json][timeout:200];
retro ('2018-01-01T00:00:00Z') {
// gather results
(
nwr["amenity"="restaurant"]({{bbox}});
);
// print results
out body;
>;
out skel qt;
}
There is this old discussion:
In that discussion @SomeoneElse linked to this overpass query:
Probably not exactly what you are looking for but maybe it helps.
Like the example above, that is just “show me what things were like on a date in the past”, not also checking that they have since been deleted. I’m sure some Overpass wizard will be along shortly to help with that bit
The longer the time range, the longer the result will take.
This query will return all modified and deleted amenity=restaurant objects. You need to look in the text box and filter out the deleted ones. I’m looking for the correct query, if it exists, for elements (id) that have changed key=value.
[adiff:"2025-01-01T00:00:00Z","2023-01-01T00:00:00Z"]; nwr["amenity"="restaurant"]({{bbox}}); compare(delta:1); out geom meta;
I noticed that this query does not find objects created and deleted between two timestamps.
This query will find objects which existed at one time stamp and don’t exist at a later timestamp, right?
I assume it will not report objects which were created and deleted / changed between those two timestamps.
Yes, you are right. Now I noticed that it does not find objects created and deleted between two dates.
Try to see overpassQL
https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL
Upps, a small mistake in the order of the dates, sorry, I was doing trial and error and I mixed up the text on my clipboard.
The query has the date ranges in reverse order, OverPass cannot interpret the date range and uses the most recent one or the first.
Only 2 numbers need to be changed.
[adiff:"2023-01-01T00:00:00Z","2025-01-01T00:00:00Z"]; nwr["amenity"="restaurant"]({{bbox}}); compare(delta:1); out geom meta;
The following is the tutorial I use for various complex queries that I don’t find in the OverPass API.
https://dev.overpass-api.de/overpass-doc/en/analysis/museum.html
HI I’m still interested in seeing if anyone has ever got this working. I’m looking for trails that might have been deleted in the past year or so. But I think this would be a useful query for many other things too.
When testing I used the above query changed to look for ways with highway tags. It seems to be great at finding NEW ways created between the two time stamps. But unfortunately it does not display ways that have been deleted. Even if those ways existed before the 1st time stamp.
[adiff:"2025-01-01T00:00:00Z","2025-04-07T00:00:00Z"];
way[highway]({{bbox}});
compare(delta:1);
out geom meta;
The best solution I’ve found is to use “retro” and change the date, going month my month, looking back and trying to compare it. This is pretty tedious, and would love it if I could just run 1 query instead.
retro ('2025-01-01T00:00:00Z'){
nwr["highway"]({{bbox}});
out geom meta;
}
Here is an example:
- This was an old trail network that was completely changed, some trails didn’t exist on the ground anymore, but they were all still in OSM on the date of: 2025-01-01.
- Between the dates 2025-01-01 and 2025-04-07 the trails were removed (based on local survey) and new trails were added.
- But you can see using the “adiff query” only shows the NEW trails, not the ones that had been deleted.
So if anyone has figured out how to also show the trails that have been deleted that would be awesome! Thanks for any help!
SOLVED. Almost immediately after my post I realized my problem was switched around the two dates.
Putting the current date 1st seems to work, but that’s backwards from what afgb1977 said above, whatever works I guess? Sorry to waste your time, but Ill leave up in case someone else needs this.
So this shows New and Deleted ways between two times:
[adiff:"2025-04-01T00:00:00Z","2025-01-01T00:00:00Z"];
way[highway]({{bbox}});
compare(delta:1);
out geom meta;
Nice work. It looks like it really works.