-
Notifications
You must be signed in to change notification settings - Fork 363
Description
Hello,
I want to use the LeafLet Routing Machine solution with a fixed starting point that will be the same as the arrival point whose coordinates I know. For this, no problem.
I want the intermediate WayPoints coordinates to come from a GeoJson structure of the following type:
const sites_culture = {
"type": "FeatureCollection",
"name": "sites_culture",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "name": "MUSEON ARLATEN", "address": "29 Rue de la République", "commune": "13200 ARLES", "tel": "04 13 31 51 79/99", "policy": "Culture" }, "geometry": { "type": "Point", "coordinates": [ 4.626015921662016, 43.676486873401274 ] } },
{ "type": "Feature", "properties": { "name": "MDAA - ARLES", "address": "29 Rue de la République", "municipality": "13200 ARLES", "tel": "04 13 31 51 03", "politics": "Culture" }, "geometry": { "type": "Point", "coordinates": [ 4.616614226966669, 43.67205666986852 ] } },
{ "type": "Feature", "properties": { "name": "Etang des Aulnes - SAINT-MARTIN-DE-CRAU", "address": "1676 Chemin d'Istres à l'Etang des Aulnes", "municipality": "13310 SAINT-MARTIN-DE-CRAU", "tel": "04 13 31 63 96", "politics": "Culture" }, "geometry": { "type": "Point", "coordinates": [ 4.78871613086454, 43.59676153502288 ] } },
{ "type": "Feature", "properties": { "name": "Château d'Avignon - SAINTES-MARIES-DE-LA-MER", "address": "RD 570", "municipality": "13460 SAINTES-MARIES-DE-LA-MER", "tel": "04 13 31 13 13", "politics": "Culture" }, "geometry": { "type": "Point", "coordinates": [ 4.411424362314144, 43.55804568265447 ] } },
{ "type": "Feature", "properties": { "name": "Archives et Bibliothèque Départementales des Bouches-du Rhône", "adresse": "18 - 20 Rue Mirès", "commune": "13003 MARSEILLE", "tel": "04 13 31 82 00", "politique": "Culture" }, "geometry": { "type": "Point", "coordinates": [ 5.369675449734724, 43.31173470954983 ] } }
]
}
How should I call these coordinates in the intermediate WayPoints?
var control = L.Routing.control({
waypoints: [
L.latLng(43.27493085740852, 5.695082510623004),
L.latLng(?, ?),
...
L.latLng(?, ?),
L.latLng(43.27493085740852, 5.695082510623004)
],
router: new L.Routing.osrmv1({
language: 'en',
profile: 'car'
}),
geocoder: L.Control.Geocoder.nominatim({}),
routeWhileDragging: true,
reverseWaypoints: true,
fitSelectedRoutes: true
}).addTo(map);
Thank you in advance for your help.
Didier