diff --git a/frontend/components/media/MediaMap.vue b/frontend/components/media/MediaMap.vue
index bb11d0203..3b0d9581d 100644
--- a/frontend/components/media/MediaMap.vue
+++ b/frontend/components/media/MediaMap.vue
@@ -9,7 +9,7 @@
import MapLibreGlDirections, {
layersFactory,
} from "@maplibre/maplibre-gl-directions";
-import maplibregl from "maplibre-gl";
+import maplibregl, { Map } from "maplibre-gl";
import "maplibre-gl/dist/maplibre-gl.css";
const props = defineProps<{
@@ -126,6 +126,14 @@ const mapProfile = (profile: string) => {
let selectedRoute = mapProfile(routeProfileOptions.FOOT);
+const toggleLayerHandler = (map: Map) => {
+ if (currentProfile === walkingRouteProfileControl) {
+ map.setLayoutProperty("cycle-layer", "visibility", "visible");
+ } else {
+ map.setLayoutProperty("cycle-layer", "visibility", "none");
+ }
+};
+
const routeProfileHandler = () => {
if (currentProfile === walkingRouteProfileControl) {
currentProfile = bikeRouteProfileControl;
@@ -167,7 +175,18 @@ onMounted(() => {
tiles: ["https://tile.openstreetmap.org/{z}/{x}/{y}.png"],
tileSize: 256,
attribution:
- 'Data © OpenStreetMap contributors',
+ '© OpenStreetMap contributors',
+ },
+ "cycle-raster-tiles": {
+ type: "raster",
+ tiles: [
+ "https://a.tile-cyclosm.openstreetmap.fr/cyclosm-lite/{z}/{x}/{y}.png",
+ "https://b.tile-cyclosm.openstreetmap.fr/cyclosm-lite/{z}/{x}/{y}.png",
+ "https://c.tile-cyclosm.openstreetmap.fr/cyclosm-lite/{z}/{x}/{y}.png",
+ ],
+ tileSize: 256,
+ attribution:
+ 'CyclOSM tiles hosted by OpenStreetMap France',
},
},
layers: [
@@ -180,12 +199,22 @@ onMounted(() => {
},
},
{
- id: "simple-tiles",
+ id: "default-layer",
type: "raster",
source: "raster-tiles",
minzoom: 0,
maxzoom: 24,
},
+ {
+ id: "cycle-layer",
+ type: "raster",
+ source: "cycle-raster-tiles",
+ minzoom: 0,
+ maxzoom: 20,
+ layout: {
+ visibility: "none",
+ },
+ },
],
},
center: [parseFloat(location["lon"]), parseFloat(location["lat"])],
@@ -304,6 +333,8 @@ onMounted(() => {
div.innerHTML = currentProfile;
const updateSelectedProfile = () => {
+ toggleLayerHandler(map);
+
directions.destroy();
div.innerHTML = routeProfileHandler();