我认为它们是 L.Routing.control 的产物,但我不想要它们,而且据我所知,它们没有提供任何功能。请帮我删除它们。
当我计算这样的路线时,我得到了它们。我的主要目标是计算从一个 START 到 18 个 Parkhouses 的所有可能路线,而不是绘制它们。我只想获取这些对象的总距离和航点。
我的参考代码:
route = L.Routing.control({
name: id,
serviceUrl: 'http://router.project-osrm.org/route/v1',
waypoints: coords,
plan: L.Routing.plan(coords, {
createMarker: function() {
return null;
}
}),
addWaypoints: false,
draggableWaypoints: false,
show: false,
showAlternatives: true
}).on('routesfound', function(e) {
for (let index = 0; index < e.routes.length; index++) {
tmpRoutes.push(e);
tmpDistances.push(e.routes[index].summary.totalDistance);
tmpWayPoints.push(e.routes[index].waypoints)
}
map.removeControl(e.routes);
}).addTo(map);
//map.removeControl(route);
}
谢谢!