diff --git a/umap/settings/base.py b/umap/settings/base.py index dbccaea9..f9fb2c4e 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -239,6 +239,7 @@ UMAP_EXTRA_URLS = { "routing": "http://www.openstreetmap.org/directions?engine=osrm_car&route={lat},{lng}&locale={locale}#map={zoom}/{lat}/{lng}", # noqa "ajax_proxy": "/ajax-proxy/?url={url}&ttl={ttl}", "search": "https://photon.komoot.io/api/?", + "edit_in_osm": "https://www.openstreetmap.org/edit#map={zoom}/{lat}/{lng}", } UMAP_KEEP_VERSIONS = env.int("UMAP_KEEP_VERSIONS", default=10) SITE_URL = env("SITE_URL", default="http://umap.org") diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 332f8dab..93276395 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -1769,9 +1769,24 @@ U.Map = L.Map.extend({ callback: this.openExternalRouting, }) } + if (this.options.urls.edit_in_osm) { + items.push('-', { + text: L._('Edit in OpenStreetMap'), + callback: this.editInOSM, + }) + } this.options.contextmenuItems = items }, + editInOSM: function (e) { + const url = this.urls.get('edit_in_osm', { + lat: e.latlng.lat, + lng: e.latlng.lng, + zoom: Math.max(this.getZoom(), 16), + }) + if (url) window.open(url) + }, + openExternalRouting: function (e) { const url = this.urls.get('routing', { lat: e.latlng.lat,