feat: route tiles use OpenStreetMap standard raster for denser place/street labels
Build and push images / validate (push) Successful in 3s
Build and push images / build-backend (push) Successful in 5s
Build and push images / build-worker (push) Successful in 5s
Build and push images / build-frontend (push) Successful in 9s

This commit is contained in:
2026-06-23 12:11:59 +01:00
parent 62cea59ef8
commit 0901ed0ef3
+3 -11
View File
@@ -2,11 +2,8 @@ import { useEffect, useRef } from 'react'
import L from 'leaflet'
import { sportColor } from '../../utils/format'
// Voyager raster tiles — same street style used on the activity map. We split
// the basemap (no labels) from a labels-only overlay so place names can be drawn
// *above* the route line instead of being hidden underneath it.
const BASE_URL = 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}{r}.png'
const LABELS_URL = 'https://{s}.basemaps.cartocdn.com/rastertiles/voyager_only_labels/{z}/{x}/{y}{r}.png'
// OpenStreetMap standard raster — denser street/place labels than Carto Voyager.
const TILE_URL = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
function decodePolyline(encoded) {
if (!encoded) return []
@@ -41,12 +38,7 @@ export default function RouteTileMap({ polyline, sportType, className = '' }) {
zoomSnap: 0,
})
mapRef.current = map
L.tileLayer(BASE_URL, { maxZoom: 19 }).addTo(map)
// A dedicated high-z pane keeps the labels overlay on top of the route line.
map.createPane('labels')
map.getPane('labels').style.zIndex = 650
map.getPane('labels').style.pointerEvents = 'none'
L.tileLayer(LABELS_URL, { maxZoom: 19, pane: 'labels' }).addTo(map)
L.tileLayer(TILE_URL, { maxZoom: 19, subdomains: 'abc' }).addTo(map)
return () => { map.remove(); mapRef.current = null }
}, [])