nrenner / brouter-web

Web client for BRouter, a routing engine based on OpenStreetMap
https://brouter.de/brouter-web/
MIT License
347 stars 65 forks source link

Enable "Edit" link in attribution for openstreetmap.org map layer #772

Closed rkflx closed 5 months ago

rkflx commented 10 months ago

Currently in the lower right of the map there is an attribution link, which for the "OpenStreetMap" base layer opens a new tab with osm.org at the current location. Only after navigating to osm.org there is then a way for users to contribute back to OSM, i.e. edit the map, which is essential in the long-term for both BRouter-Web's (maps) and BRouter's (routing data) success too.

To make it more obvious that users are allowed and encouraged to contribute to OSM, here we add another link called "Edit", which hopefully will make users curious and entice them to click on it. Clicking on the link will result in osm.org opening in a new tab too, but this time in edit mode. If not logged in, users will be prompted to log in or sign up. If logged in, the web-based iD editor will start immediately.

Note that the value proposition of that button is not so much in linking to osm.org (we already do that), but that it is clearly labeled "Edit" (getting users interested / making them aware) and that it only appears on osm.org, but not e.g. for "Esri World Imagery" which cannot be edited anyway.

In addition, the link saves an extra click compared to opening osm.org in non-edit mode first and having to separately click on "Edit". Under osm.org's "My Preferences" > "Edit Preferences" it is even possible to configure a default editor when logged in, so clicking on the "Edit" link in BRouter-Web would change e.g. JOSM's current viewport via its "Remote Control" interface immediately, no extra clicks needed (apart from closing/switching away from the new/updated osm.org tab again, admittedly).

The target audience for the link are occasional and novice OSM users. Power users should use browser addons like "OSM Smart Menu" to quickly switch between map products/sites. A more elaborate "Contribute to the map" menu/popup could be added later.

Implementation-wise, the functionality is already present in the attribution control we embed from "MapBBCode/mapbbcode", we only need to enable it. Supporting more OSM-based maps in the "Edit" link would need to be implemented in "mapbbcode", it should probably evaluate "category": "osmbasedmap" as found in layers/*.geojson and/or match on more URLs.

Relates to #403 and #694.

Test Plan: