add leaflet routing

This commit is contained in:
Clement 2024-05-31 10:30:51 +02:00
parent 02e014939b
commit 032ad34a84

View File

@ -32,7 +32,7 @@ const metadata = {
import markerIcon from "leaflet/dist/images/marker-icon.png" import markerIcon from "leaflet/dist/images/marker-icon.png"
import { OpenStreetMapProvider } from 'leaflet-geosearch' import { OpenStreetMapProvider } from 'leaflet-geosearch'
import { GeoSearchControl } from 'leaflet-geosearch' import { GeoSearchControl } from 'leaflet-geosearch'
import 'leaflet-routing-machine/dist/leaflet-routing-machine.js'
const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})} const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})}
@ -62,13 +62,14 @@ const metadata = {
style: 'bar', style: 'bar',
}), }),
) )
// L.Routing.control({
// waypoints: [ L.Routing.control({
// L.latLng(57.74, 11.94), waypoints: [
// L.latLng(57.6792, 11.949) L.latLng(57.74, 11.94),
// ], L.latLng(57.6792, 11.949)
// routeWhileDragging: true ],
// }).addTo(map) routeWhileDragging: true
}).addTo(map)
let poiMarkers = new Array<L.Marker> let poiMarkers = new Array<L.Marker>