Open ntaraujo opened 2 years ago
Sorry for the late reply @ntaraujo!
If you just want to draw a polyline, you can do so using the official Leaflet docs. That's basically all L.Routing.Line
does as well
If you want to use L.Routing.Line
instead, you should be able to do something like this:
const line = new L.Routing.Line({coordinates: [L.LatLng, ...]});
map.addLayer(line);
@curtisy1 hey, your solution does not work !
I've an error Uncaught TypeError: Cannot read properties of undefined (reading 'length')
on method _findWaypointIndices
:
for (i = 0; i < wps.length; i++) {
indices.push(this._findClosestRoutePoint(wps[i].latLng));
}
wps
var is undefined, so it doesn't work :/
Yes and no. For a simple route that should only be displayed on a map, it does work. If you want interactivity, like touching the line, you are correct that this isn't covered by the example I provided.
However, you can simply pass an inputWaypoints object into the initialization and it should work.
If the issue persists, please open another issue and I will have a look at it.
Hi, I can't find on docs the way to do so, it's simple but I can't figure it out. Can someone give me an example of
L.Routing.Line
?