fix: switch server portal map tiles to CARTO (OSM was rate-limiting/blocking)
OSM tile.openstreetmap.org was returning grey tiles on the portal (likely rate-limiting the Cloudflare tunnel egress IP). Switch to CARTO Voyager tiles which are free, CDN-backed, and don't have the same restrictions. Also add data-tile-subdomains attribute support in history.js so tile provider subdomains can be configured per-deployment. Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -55,8 +55,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="card-body p-0">
|
<div class="card-body p-0">
|
||||||
<div id="history-map" aria-label="Selected trip route map"
|
<div id="history-map" aria-label="Selected trip route map"
|
||||||
data-tile-url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
data-tile-url="https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png"
|
||||||
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"
|
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors © <a href='https://carto.com/attributions'>CARTO</a>"
|
||||||
data-min-zoom="3" data-max-zoom="19"></div>
|
data-min-zoom="3" data-max-zoom="19"></div>
|
||||||
<div id="trip-timeline" class="border-top p-3" hidden>
|
<div id="trip-timeline" class="border-top p-3" hidden>
|
||||||
<div class="d-flex align-items-center gap-3">
|
<div class="d-flex align-items-center gap-3">
|
||||||
|
|||||||
@@ -13,12 +13,14 @@
|
|||||||
const mapEl = document.getElementById("history-map");
|
const mapEl = document.getElementById("history-map");
|
||||||
const tileUrl = mapEl.dataset.tileUrl || "/static/vendor/tiles/{z}/{x}/{y}.png";
|
const tileUrl = mapEl.dataset.tileUrl || "/static/vendor/tiles/{z}/{x}/{y}.png";
|
||||||
const tileAttrib = mapEl.dataset.tileAttrib || "© MapTiler © OpenStreetMap contributors";
|
const tileAttrib = mapEl.dataset.tileAttrib || "© MapTiler © OpenStreetMap contributors";
|
||||||
|
const tileSubdomains = mapEl.dataset.tileSubdomains || "abc";
|
||||||
const minZoom = parseInt(mapEl.dataset.minZoom, 10) || 3;
|
const minZoom = parseInt(mapEl.dataset.minZoom, 10) || 3;
|
||||||
const maxZoom = parseInt(mapEl.dataset.maxZoom, 10) || 19;
|
const maxZoom = parseInt(mapEl.dataset.maxZoom, 10) || 19;
|
||||||
const map = L.map("history-map", { minZoom: minZoom, maxZoom: maxZoom }).setView([48.505, -0.09], 12);
|
const map = L.map("history-map", { minZoom: minZoom, maxZoom: maxZoom }).setView([48.505, -0.09], 12);
|
||||||
const tiles = L.tileLayer(tileUrl, {
|
const tiles = L.tileLayer(tileUrl, {
|
||||||
minZoom: minZoom,
|
minZoom: minZoom,
|
||||||
maxZoom: maxZoom,
|
maxZoom: maxZoom,
|
||||||
|
subdomains: tileSubdomains,
|
||||||
attribution: tileAttrib,
|
attribution: tileAttrib,
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
let routeLayer = null;
|
let routeLayer = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user