From: Tom Hughes Date: Wed, 13 Jan 2021 20:40:48 +0000 (+0000) Subject: Merge remote-tracking branch 'upstream/pull/2994' X-Git-Tag: live~1735 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/4abd9cfcf19701bf43322374c5df6dd586449e54?hp=697e36f364506037efb198f454226ca1eb956bed Merge remote-tracking branch 'upstream/pull/2994' --- diff --git a/app/assets/javascripts/embed.js.erb b/app/assets/javascripts/embed.js.erb index 2ced018b2..d3b1ad4b2 100644 --- a/app/assets/javascripts/embed.js.erb +++ b/app/assets/javascripts/embed.js.erb @@ -39,6 +39,8 @@ window.onload = function () { if (!args.layer || args.layer === "mapnik" || args.layer === "osmarender" || args.layer === "mapquest") { new L.OSM.Mapnik(mapnikOptions).addTo(map); + } else if (args.layer === "cyclosm") { + new L.OSM.CyclOSM().addTo(map); } else if (args.layer === "cyclemap" || args.layer === "cycle map") { new L.OSM.CycleMap(thunderforestOptions).addTo(map); } else if (args.layer === "transportmap") { diff --git a/app/assets/javascripts/leaflet.map.js b/app/assets/javascripts/leaflet.map.js index d47b89617..ffb2d7a21 100644 --- a/app/assets/javascripts/leaflet.map.js +++ b/app/assets/javascripts/leaflet.map.js @@ -18,6 +18,7 @@ L.OSM.Map = L.Map.extend({ var copyright = I18n.t("javascripts.map.copyright", { copyright_url: "/copyright" }); var donate = I18n.t("javascripts.map.donate_link_text", { donate_url: "https://donate.openstreetmap.org" }); var terms = I18n.t("javascripts.map.terms", { terms_url: "https://wiki.osmfoundation.org/wiki/Terms_of_Use" }); + var cyclosm = I18n.t("javascripts.map.cyclosm", { cyclosm_url: "https://www.cyclosm.org", osmfrance_url: "https://openstreetmap.fr/" }); var thunderforest = I18n.t("javascripts.map.thunderforest", { thunderforest_url: "https://www.thunderforest.com/" }); var memomaps = I18n.t("javascripts.map.opnvkarte", { memomaps_url: "https://memomaps.de/" }); var hotosm = I18n.t("javascripts.map.hotosm", { hotosm_url: "https://www.hotosm.org/", osmfrance_url: "https://openstreetmap.fr/" }); @@ -31,6 +32,13 @@ L.OSM.Map = L.Map.extend({ name: I18n.t("javascripts.map.base.standard") })); + this.baseLayers.push(new L.OSM.CyclOSM({ + attribution: copyright + ". " + cyclosm + ". " + terms, + code: "Y", + keyid: "cyclosm", + name: I18n.t("javascripts.map.base.cyclosm") + })); + if (OSM.THUNDERFOREST_KEY) { this.baseLayers.push(new L.OSM.CycleMap({ attribution: copyright + ". " + thunderforest + ". " + terms, diff --git a/config/locales/en.yml b/config/locales/en.yml index 4f97a3fb1..a520fcb02 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2696,6 +2696,7 @@ en: other: You are within %{count} feet of this point base: standard: Standard + cyclosm: CyclOSM cycle_map: Cycle Map transport_map: Transport Map hot: Humanitarian @@ -2710,6 +2711,7 @@ en: copyright: "© OpenStreetMap contributors" donate_link_text: "" terms: "Website and API terms" + cyclosm: "Tiles style by CyclOSM hosted by OpenStreetMap France" thunderforest: "Tiles courtesy of Andy Allan" opnvkarte: "Tiles courtesy of MeMoMaps" hotosm: "Tiles style by Humanitarian OpenStreetMap Team hosted by OpenStreetMap France" diff --git a/vendor/assets/leaflet/leaflet.osm.js b/vendor/assets/leaflet/leaflet.osm.js index ad712e3a2..6e8e20ba6 100644 --- a/vendor/assets/leaflet/leaflet.osm.js +++ b/vendor/assets/leaflet/leaflet.osm.js @@ -19,6 +19,15 @@ L.OSM.Mapnik = L.OSM.TileLayer.extend({ } }); +L.OSM.CyclOSM = L.OSM.TileLayer.extend({ + options: { + url: 'https://{s}.tile-cyclosm.openstreetmap.fr/cyclosm/{z}/{x}/{y}.png', + maxZoom: 20, + subdomains: 'abc', + attribution: '© OpenStreetMap contributors. Tiles courtesy of OpenStreetMap France' + } +}); + L.OSM.CycleMap = L.OSM.TileLayer.extend({ options: { url: 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}{r}.png?apikey={apikey}',