I have an array with coordinates ([[54.73, 55.74], [55.66, 54.73]...]). I want to get route from each point to another. E.g. if I have 3 points a1, a2, a3, I want to calculate routes a1a2, a1a3, a2a1, a2a3 etc. I need this to make distance matrix later. Here is my loop where coords
is array of coordinates
function routingLoop() {
for (var i = 0; i < coords.length; i++){
for (var j = 0; j < coords.length; j++){
var routing;
routing = L.routing.control({
waypoints:[
L.latLng(coords[i][0], coords[i][1]),
L.latLng(coords[j][0], coords[j][1]),
],
}).addTo(Map);
}
}
}
But I get this error Routing error:
Object { status: -3, message: "TypeError: this._altContainer is undefined" }
. Any ideas what's wrong with that code?
i === j
andcontinue
the loop.