Reputation: 463
Does anybody knows how to create new line object of L.Routing.line()
.
I want to draw routing line between two points. I am able to achieve it through L.Routing.control
however it is adding direction control which I do not required.
Please provide example.
Upvotes: 2
Views: 3686
Reputation: 41
var router = L.Routing.osrm(),waypoints = [],line;
waypoints.push({latLng: L.latLng(52.19226,0.15216)});
waypoints.push({latLng: L.latLng(52.15247,0.14019)});
router.route (waypoints,function(err, routes) {
if (line) {
map.removeLayer(line);
}
if (err) {
alert(err);
} else {
line = L.Routing.line(routes[0]).addTo(demo_layer);
}
});
Upvotes: 3