]> git.openstreetmap.org Git - rails.git/commitdiff
Add Tracestrack Topo as featured layer
authorPaul Norman <penorman@mac.com>
Wed, 20 Sep 2023 05:16:42 +0000 (22:16 -0700)
committerPaul Norman <penorman@mac.com>
Wed, 20 Sep 2023 05:16:42 +0000 (22:16 -0700)
app/assets/javascripts/leaflet.map.js
app/assets/javascripts/osm.js.erb
config/initializers/secure_headers.rb
config/locales/en.yml
config/settings.yml
vendor/assets/leaflet/leaflet.osm.js

index 6e61100f2effb01dbfdc7c255a1d51245c1f6741..b992b5c8aed9a739e9cf0771c9442966aaeafaa0 100644 (file)
@@ -51,6 +51,13 @@ L.OSM.Map = L.Map.extend({
     }).prop("outerHTML");
     var thunderforest = I18n.t("javascripts.map.thunderforest_credit", { thunderforest_link: thunderforest_link });
 
+    var tracestrack_link = $("<a>", {
+      href: "https://www.tracestrack.com/",
+      target: "_blank",
+      text: I18n.t("javascripts.map.tracestrack")
+    }).prop("outerHTML");
+    var tracestrack = I18n.t("javascripts.map.tracestrack_credit", { tracestrack_link: tracestrack_link });
+
     var memomaps_link = $("<a>", {
       href: "https://memomaps.de/",
       target: "_blank",
@@ -99,6 +106,15 @@ L.OSM.Map = L.Map.extend({
       }));
     }
 
+    if (OSM.TRACESTRACK_KEY) {
+      this.baseLayers.push(new L.OSM.TracestrackTopo({
+        attribution: copyright + ". " + tracestrack + ". " + terms,
+        apikey: OSM.TRACESTRACK_KEY,
+        code: "P",
+        keyid: "tracestracktopo",
+        name: I18n.t("javascripts.map.base.tracestracktop_topo")
+      }));
+    }
     this.baseLayers.push(new L.OSM.OPNVKarte({
       attribution: copyright + ". " + memomaps + ". " + terms,
       code: "O",
index 0ffd35e2ceabfc922889ce572b727e8db3e272a2..0a0f5c67a7c5a9df678e3cb1e7168f46f90434ee 100644 (file)
@@ -25,6 +25,10 @@ OSM = {
   THUNDERFOREST_KEY:       <%= Settings.thunderforest_key.to_json %>,
 <% end %>
 
+<% if Settings.key?(:tracestrack_key) %>
+  TRACESTRACK_KEY:         <%= Settings.tracestrack_key.to_json %>,
+<% end %>
+
   MARKER_GREEN:            <%= image_path("marker-green.png").to_json %>,
   MARKER_RED:              <%= image_path("marker-red.png").to_json %>,
 
index e710019da30b70fcc7e8b98e870b63573ccfb3cd..778b5b827aff877439565a0a322ddc1809f28678 100644 (file)
@@ -7,7 +7,7 @@ csp_policy = {
   :form_action => %w['self'],
   :frame_ancestors => %w['self'],
   :frame_src => %w['self'],
-  :img_src => %w['self' data: www.gravatar.com *.wp.com tile.openstreetmap.org *.tile.openstreetmap.org *.tile.thunderforest.com tileserver.memomaps.de *.openstreetmap.fr],
+  :img_src => %w['self' data: www.gravatar.com *.wp.com tile.openstreetmap.org *.tile.openstreetmap.org *.tile.thunderforest.com tileserver.memomaps.de tile.tracestrack.com *.openstreetmap.fr],
   :manifest_src => %w['self'],
   :media_src => %w['none'],
   :object_src => %w['self'],
index ec845dc7c412426cae4875c7ee7d56fe84f30619..530dad2079f530f8134ee38cd37a020e68baafeb 100644 (file)
@@ -2966,6 +2966,7 @@ en:
         cyclosm: CyclOSM
         cycle_map: Cycle Map
         transport_map: Transport Map
+        tracestracktop_topo: Tracestrack Topo
         hot: Humanitarian
         opnvkarte: ÖPNVKarte
       layers:
@@ -2986,6 +2987,8 @@ en:
       andy_allan: Andy Allan
       opnvkarte_credit: "Tiles courtesy of %{memomaps_link}"
       memomaps: MeMoMaps
+      tracestrack_credit: "Tiles courtesy of %{tracestrack_link}"
+      tracestrack: Tracestrack
       hotosm_credit: "Tiles style by %{hotosm_link} hosted by %{osm_france_link}"
       hotosm_name: Humanitarian OpenStreetMap Team
     site:
index 3ea298efcb4378f4073397d02d301d785c772ff2..e228247e03d617b5a4d1cd957b21b6498dca01e3 100644 (file)
@@ -117,6 +117,8 @@ fossgis_valhalla_url: "https://valhalla1.openstreetmap.de/route"
 #wikipedia_auth_secret: ""
 # Thunderforest authentication details
 #thunderforest_key: ""
+# Tracestrack authentication details
+#tracestrack_key: ""
 # Key for generating TOTP tokens
 #totp_key: ""
 # Enforce Content-Security-Policy
index 6e8e20ba68fe5deac22fbfa09a2e5b61a49f9e2f..0e51f34086a974478e44550921495494ba9f5359 100644 (file)
@@ -61,6 +61,14 @@ L.OSM.HOT = L.OSM.TileLayer.extend({
   }
 });
 
+L.OSM.TracestrackTopo = L.OSM.TileLayer.extend({
+  options: {
+    url: 'https://tile.tracestrack.com/topo__/{z}/{x}/{y}.png?key={apikey}',
+    maxZoom: 19,
+    attribution: '© <a href="https://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors. Tiles courtesy of <a href="https://www.tracestrack.com/" target="_blank">Tracestrack Maps</a>'
+  }
+});
+
 L.OSM.GPS = L.OSM.TileLayer.extend({
   options: {
     url: 'https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png',