Merge remote-tracking branch 'upstream/pull/2994'
authorTom Hughes <tom@compton.nu>
Wed, 13 Jan 2021 20:40:48 +0000 (20:40 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 13 Jan 2021 20:40:48 +0000 (20:40 +0000)
app/assets/javascripts/embed.js.erb
app/assets/javascripts/leaflet.map.js
config/locales/en.yml
vendor/assets/leaflet/leaflet.osm.js

index 2ced018b29eb58a801fc2438a44b81e695c79bd4..d3b1ad4b28e8bdeccf7bc7d19d848e0294daef78 100644 (file)
@@ -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") {
index d47b896177b6c10617201959ef821d15d261d27e..ffb2d7a2140f52199e28e4521cea68b5f6ed65c1 100644 (file)
@@ -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,
index 4f97a3fb196a3ddf99d534d490b379379e707bd6..a520fcb0286d0df49ef09bafe208e7f711977060 100644 (file)
@@ -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: "© <a href='%{copyright_url}'>OpenStreetMap contributors</a>"
       donate_link_text: "<a class='donate-attr' href='%{donate_url}'>Make a Donation</a>"
       terms: "<a href='%{terms_url}' target='_blank'>Website and API terms</a>"
+      cyclosm: "Tiles style by <a href='%{cyclosm_url}' target='_blank'>CyclOSM</a> hosted by <a href='%{osmfrance_url}' target='_blank'>OpenStreetMap France</a>"
       thunderforest: "Tiles courtesy of <a href='%{thunderforest_url}' target='_blank'>Andy Allan</a>"
       opnvkarte: "Tiles courtesy of <a href='%{memomaps_url}' target='_blank'>MeMoMaps</a>"
       hotosm: "Tiles style by <a href='%{hotosm_url}' target='_blank'>Humanitarian OpenStreetMap Team</a> hosted by <a href='%{osmfrance_url}' target='_blank'>OpenStreetMap France</a>"
index ad712e3a2f78bb07b13da28ff7f639541683333a..6e8e20ba68fe5deac22fbfa09a2e5b61a49f9e2f 100644 (file)
@@ -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: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="https://www.openstreetmap.fr" target="_blank">OpenStreetMap France</a>'
+  }
+});
+
 L.OSM.CycleMap = L.OSM.TileLayer.extend({
   options: {
     url: 'https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}{r}.png?apikey={apikey}',