Zverik / every_door

A dedicated app for collecting thousands of POI for OpenStreetMap
https://every-door.app
ISC License
412 stars 35 forks source link

Write a simpler OSM history viewer #293

Closed Zverik closed 2 years ago

Zverik commented 2 years ago

See #263 for discussion and prior work.

GeorgeHoneywood commented 2 years ago

Hey! I've had a go at this. Code is a bit of a mess at the moment so I haven't opened a PR yet.

Any suggestions for the UI? I'm not sure about also rendering geometry changes -- it would be quite complex and I think it would need a network request for each version.

Zverik commented 2 years ago

Hey, this looks really nice and clean! It misses changeset comments, which I think are important. Other than that, it fits the editor, since it doesn't need geometry.

For rendering geometry, you would need to bulk request node history of every children node for all versions (and you receive their ids with a single query to /history). It shouldn't be too many though. And that's for ways: for nodes you get all the history you need with the single request.

I'd incorporate geometry cards here in collapsed rows, and only for the first version and for these that have the geometry changed. But again, that's not mandatory: people usually refer to the history for tag changes.

GeorgeHoneywood commented 2 years ago

Thanks for the feedback! I'll get the code polished up and open a PR.

I'll leave geometry diffs out for now, I agree just showing tag changes suits the editor well enough. The "No tag changes" message should make it clear that geometry changes aren't shown. Rendering the diff on a map probably will be quite involved too.

Showing the changeset comments should just involve one request to the changesets endpoint. It says that it is limited to 100 ids so it is okay for 99% of elements, and it can be chunked if required. Most of the work will probably be creating some test element with 101 versions on the dev API :)

Get all changeset details for specific element with curl & jq ```shell ➜ curl -s -H "Accept: application/json" \ "https://api.openstreetmap.org/api/0.6/changesets?changesets=$(curl -s 'https://api.openstreetmap.org/api/0.6/way/152475305/history.json' | jq -r '[.elements[].changeset] | join(",")')" | jq ``` ```json { "version": "0.6", "generator": "OpenStreetMap server", "copyright": "OpenStreetMap and contributors", "attribution": "http://www.openstreetmap.org/copyright", "license": "http://opendatacommons.org/licenses/odbl/1-0/", "changesets": [ { "id": 122676443, "created_at": "2022-06-21T16:30:44Z", "open": false, "comments_count": 0, "changes_count": 3, "closed_at": "2022-06-21T16:30:44Z", "min_lat": 51.4274216, "min_lon": -0.5508851, "max_lat": 51.4304338, "max_lon": -0.5480023, "uid": 10031443, "user": "GeorgeHoneywood", "tags": { "created_by": "Every Door Android 0.5.0", "comment": "Created a grit_bin and a waste_basket; Updated a restaurant" } }, { "id": 103425047, "created_at": "2021-04-22T16:15:31Z", "open": false, "comments_count": 0, "changes_count": 25, "closed_at": "2021-04-22T16:15:34Z", "min_lat": 51.4239773, "min_lon": -0.5813147, "max_lat": 51.4329127, "max_lon": -0.5480023, "uid": 10031443, "user": "GeorgeHoneywood", "tags": { "source": "Bing; FHRS", "created_by": "JOSM/1.5 (17580 en_GB)", "comment": "More FHRS matching in Egham/Englefield Green" } }, { "id": 51779843, "created_at": "2017-09-06T12:16:59Z", "open": false, "comments_count": 0, "changes_count": 1, "closed_at": "2017-09-06T12:16:59Z", "min_lat": 51.4302917, "min_lon": -0.5482958, "max_lat": 51.4304338, "max_lon": -0.5480023, "uid": 1878856, "user": "yourealwaysbe", "tags": { "comment": "lounge is now heleni", "created_by": "iD 2.4.1", "imagery_used": "Bing aerial imagery", "host": "https://www.openstreetmap.org/edit", "locale": "en-GB", "changesets_count": "1793" } }, { "id": 47092899, "created_at": "2017-03-23T10:42:21Z", "open": false, "comments_count": 0, "changes_count": 1, "closed_at": "2017-03-23T10:42:21Z", "min_lat": 51.4302917, "min_lon": -0.5482958, "max_lat": 51.4304338, "max_lon": -0.5480023, "uid": 1878856, "user": "yourealwaysbe", "tags": { "created_by": "iD 2.1.3", "imagery_used": "Bing aerial imagery", "host": "https://www.openstreetmap.org/id", "locale": "en-GB", "comment": "new restaurant egham" } }, { "id": 37315870, "created_at": "2016-02-19T19:27:27Z", "open": false, "comments_count": 2, "changes_count": 136, "closed_at": "2016-02-19T19:27:57Z", "min_lat": 50.0134974, "min_lon": -6.1736977, "max_lat": 58.9382142, "max_lon": 2.4304521, "uid": 436419, "user": "wvdp", "tags": { "comment": "checking all opening hours part 1", "created_by": "JOSM/1.5 (9329 en)", "source": "Mapbox Satellite" } }, { "id": 33470933, "created_at": "2015-08-20T20:44:07Z", "open": false, "comments_count": 0, "changes_count": 59, "closed_at": "2015-08-20T20:44:10Z", "min_lat": 51.4290397, "min_lon": -0.5492215, "max_lat": 51.4304544, "max_lon": -0.5464622, "uid": 1878856, "user": "yourealwaysbe", "tags": { "created_by": "iD 1.7.3", "imagery_used": "Bing", "host": "https://www.openstreetmap.org/id", "locale": "en-GB", "comment": "features around egham station" } } ] } ```
Zverik commented 2 years ago

I think you can cap the number of versions at ~30 :)