Hello, I'm working on an ionic project, the problem here, everything is okay, it displays correctly the navigation in the control but in the map ,it shows me the wrong route navigation
here is an example :
Here is some of my code :
this.map = new L.Map('mapinfoentreprise').setView([36.8065,10.1815], 15);
const options = { profile: "mapbox/driving", polylinePrecision: 6 };
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution:'Gaea21'
}).addTo(this.map);
var routeControl= L.Routing.control({
waypoints: [
L.latLng(36.8065, 10.1815),
L.latLng(37.2768, 9.8642)
],
router: (L.Routing as any).mapbox("api_key", options),
routeWhileDragging: false,
});
var routeBlock = routeControl.onAdd(this.map);
// display the control in a div
document.getElementById('controls').appendChild(routeBlock);
routeControl.on('routesfound', function(e) {
var routes = e.routes;
var summary = routes[0].summary;
console.log('Total distance is ' + summary.totalDistance / 1000 + ' km and total time is ' + Math.round(summary.totalTime % 3600 / 60) + ' minutes');
});
Did anyone faced this problem before ? and how can I fix it ?
Hello, I'm working on an ionic project, the problem here, everything is okay, it displays correctly the navigation in the control but in the map ,it shows me the wrong route navigation here is an example :
Here is some of my code :
Did anyone faced this problem before ? and how can I fix it ?