I'm actually working for a school project with the Leaflet Routing Machine and having issue withe the totalTime method.
var map = L.map('map');
L.tileLayer('', {
attribution: ''
}).addTo(map);
L.Routing.control({
waypoints: [
L.latLng(45.7979, 4.7178),
L.latLng(45.5221, 4.8101),
L.latLng(45.42, 4.35)
],
routeWhileDragging: true,
language: 'fr'
}).addTo(map);
L.Routing.control({
waypoints: [
L.latLng(44.7979, 4.7178),
L.latLng(45.42, 4.35)
],
routeWhileDragging: true,
language: 'fr'
}).addTo(map);
window.alert(routes[0].summary.totalTime());
But JS console is telling me that routes[] isn't defined.
Is there anything wrong ? Should we use something else than routes[] ?
routesanywhere in this code. - GAntoinetotalTime. liedman.net/leaflet-routing-machine/api/#irouter I've found this topic : stackoverflow.com/questions/26570980/… So i tried it. - koolok