Fix remote portal map tiles and geocode
- history.js reads tile URL from data-tile-url attribute on #history-map div, falling back to local offline tiles (Pi behavior unchanged) - server history.html sets data-tile-url to live OSM tiles - maxZoom raised to 19 (OSM supports it, local tiles were limited to 15) - server geocode returns 'label' key to match what history.js/yaris.js expect Co-authored-by: Copilot <[email protected]>
This commit is contained in:
+1
-1
@@ -542,7 +542,7 @@ def geocode():
|
|||||||
lon4 = int(round(lon, 4) * 10000)
|
lon4 = int(round(lon, 4) * 10000)
|
||||||
name = _geocode_cached(lat4, lon4)
|
name = _geocode_cached(lat4, lon4)
|
||||||
if name:
|
if name:
|
||||||
return jsonify(name=name)
|
return jsonify(label=name)
|
||||||
return jsonify(name=None), 204
|
return jsonify(name=None), 204
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</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>
|
<div id="history-map" aria-label="Selected trip route map"
|
||||||
|
data-tile-url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
|
||||||
|
data-tile-attrib="© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors"></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">
|
||||||
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
|
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
|
||||||
|
|||||||
@@ -10,11 +10,14 @@
|
|||||||
const playButton = document.getElementById("trip-play");
|
const playButton = document.getElementById("trip-play");
|
||||||
const replayTime = document.getElementById("trip-replay-time");
|
const replayTime = document.getElementById("trip-replay-time");
|
||||||
const replaySpeed = document.getElementById("trip-replay-speed");
|
const replaySpeed = document.getElementById("trip-replay-speed");
|
||||||
const map = L.map("history-map", { minZoom: 8, maxZoom: 15 }).setView([48.505, -0.09], 12);
|
const mapEl = document.getElementById("history-map");
|
||||||
const tiles = L.tileLayer("/static/vendor/tiles/{z}/{x}/{y}.png", {
|
const tileUrl = mapEl.dataset.tileUrl || "/static/vendor/tiles/{z}/{x}/{y}.png";
|
||||||
minZoom: 8,
|
const tileAttrib = mapEl.dataset.tileAttrib || "© MapTiler © OpenStreetMap contributors";
|
||||||
maxZoom: 15,
|
const map = L.map("history-map", { minZoom: 3, maxZoom: 19 }).setView([48.505, -0.09], 12);
|
||||||
attribution: "© MapTiler © OpenStreetMap contributors",
|
const tiles = L.tileLayer(tileUrl, {
|
||||||
|
minZoom: 3,
|
||||||
|
maxZoom: 19,
|
||||||
|
attribution: tileAttrib,
|
||||||
});
|
});
|
||||||
let routeLayer = null;
|
let routeLayer = null;
|
||||||
let vehicleMarker = null;
|
let vehicleMarker = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user