osmlab / osm-planning

General OSM tools planning and wishlist
Other
18 stars 1 forks source link

OSM API deleted items call #11

Open bhousel opened 6 years ago

bhousel commented 6 years ago

from https://wiki.openstreetmap.org/wiki/Top_Ten_Tasks#OSM_API_deleted_items_call

OSM API deleted items call

Currently, there is no way to get information about items which have been deleted through the OSM API, but this information is important to implementing undelete features in clients.

There is a previous implementation of an undelete feature in Potlatch 1 which used custom code in the rails port to obtain this data. However, this implementation may not be suitable for large-scale use and attention will have to be paid to ensure that the queries run efficiently. Currently the only other way to find deleted items is to use the third-party WhoDidIt service.

There's also https://github.com/openstreetmap/openstreetmap-website/pull/1448 by @woodpeck, which is also not in a state to be merged (yet).


_This issue comes from the OSM Top Ten Tasks page_

woodpeck commented 6 years ago

Unsure what this repo is for, but would like to mention https://github.com/woodpeck/openstreetmap-cgimap/tree/deleted_call which was an attempt to solve this in cgimap. It is thematically related to openstreetmap/openstreetmap-website#1448 but while the latter was narrowly scoped to just allow the display of deleted objects on the web site and didn't implement proper all-purpose API calls, the former is a relatively comprehensive implementation that dried up because I didn't have the time to add (a) relation support and (b) duplicate the whole effort in Rails which would have been necessary for new API calls to really fly.

bhousel commented 6 years ago

Hey @woodpeck this repo is "for general planning of OpenStreetMap technology - what works, what could be better, and where we're headed. Think of it like a shared wish list." No code here, just chatter.

We (OSMUS/Mapbox) are hosting a hackathon next Monday and Tuesday so I copied the Top Ten Tasks over here for discussion. I don't actually think most of the Top Ten Tasks are suitable for the hackathon, but it's nice to have them on GitHub so we can link and tag people and discuss.

Is there anything that I (or anyone) can do to help move openstreetmap/openstreetmap-website#1448 forward? It would be pretty great to be able to visualize deleted items on on openstreetmap.org history pages..

We're are also partnering with Ruby4Good next month and would love to steer some developers towards helping out with OSM projects, if they can make a difference. (cc @mikelmaron)

woodpeck commented 6 years ago

openstreetmap/openstreetmap-website#1448 is a working hack, and it was rejected because it was a hack, not because it wasn't working ;) as you can see from @tomhughes' comment there, he was unwilling to accept a hack even if the result was useful, which is of course a valid policy to have, but it means that you'll actually have to go through the exercise of implementing solid "deleted objects" calls in cgimap and Rails which is quite a bit of work.

The complexity in accessing deleted objects comes from API calls that make connections between them. It is trivial to have an API call that says "give me the last un-deleted version of this object". However, if the object is a way or a relation, you will often need the member objects as well, e.g. to draw something; and then the question is: if the deleted way 1234 was using node 2345, which version of node 2345 will you return? Node 2345 might or might not have been deleted meanwhile, or it might have moved to the other side of the planet, so you'd better try and return the version that was current when the way was deleted. And this complexity explodes when you talk about the "map" call which an editor might want to use ("give me all objects in this rectangle, including deleted ones") - a deleted node might have been used, at the time it was deleted, by a way, which might lead outside of the bbox, and interact with other deleted or not-deleted versions...

I guess what I want to say is, it sounds easy "make a call to access deleted versions", but if you start thinking it through, you'll hit many areas where it isn't really well defined what you're even supposed to do.

Perhaps, for tackling this within the time-box of a hackathon, you should keep the narrow focus of openstreetmap/openstreetmap-website#1448 and say "we'll implement the minimum necessary API call to make this work" while at the same time designing the API call to be later extended to a proper, well-thought-out set of "deleted" calls, so that it's not just a hack but a seed for future development.

(There is a completely different way of approaching the "show deleted objects on web site" problem which for a split second I was thinking about implementing when my "hack" was rejected, and that is working solely with the existing API calls. You'd request a way, be told it's gone, then request its history, then take the last non-deleted version, then request each node individually, again reverting to the history call when the node is deleted, and finally you'd have built your object on the Javascript side instead of on the Ruby side, at the expense of making potentially hundreds of API calls but without having to implement "more back door history hacks". I think we agree that this would be more an act of youthful defiance than one of responsible coding.)

pnorman commented 6 years ago

I wouldn't suggesst a newcomer do a deleted items call, because there's no specification of what that means, and that's the hard part.

bjohas commented 1 year ago

Hello all, has there been any progress on this? It would be very useful to be able to retrieve deleted objects - if only in a read-only way.