From bab39572a17146d5b6e696f0ba584a89daac10c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Rodrigo?= Date: Thu, 3 Dec 2020 22:40:53 +0100 Subject: [PATCH] Add CyclOSM layer --- app/assets/javascripts/embed.js.erb | 2 ++ app/assets/javascripts/leaflet.map.js | 8 ++++++++ config/locales/en.yml | 2 ++ 3 files changed, 12 insertions(+) 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 21ea7e106..e1c180253 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2689,6 +2689,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 @@ -2703,6 +2704,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" -- 2.39.5