perliedman / leaflet-routing-machine

Control for routing in Leaflet
https://www.liedman.net/leaflet-routing-machine/
Other
1.06k stars 347 forks source link

Steps in the cableway #668

Open thoarca opened 1 year ago

thoarca commented 1 year ago

Hi there, how can connect two points in cableway, using leafletmap ?

Thanks

curtisy1 commented 1 year ago

I'm guessing you would want a polyline? Or is it that you want to find the route between two stations on a cableway?

thoarca commented 1 year ago

Hi, thanks for the reply. My goal is to derive a route between two points of a exiaisting cableway. If possibile, this path will be a polyline, right? thank you

curtisy1 commented 1 year ago

Yes. Suppose you have a set of points, you could simply do the following

const points = [51.65464, 14.5756], [51.5785, 14.87575]; // your coordinates
const line = new L.Polyline(points);
line.addTo(map);

or if you want routing, you could use something like this

L.Routing.control({
    waypoints: [
        L.latLng(57.74, 11.94),
        L.latLng(57.6792, 11.949)
    ],
}).addTo(map);

although I'm not sure, how accurate the result would be since cableways are not usually included in OSRM routes as far as I know

thoarca commented 1 year ago

Hi Alex, I understand your code perfectly well. Thank you. But I need to draw the "cableway" route on a map. Using "leaflet-routing" plugin, I cannot move markers on a cable car route. For example, I know that between Chamonix and La thuile there is a cable car route. By moving the markers on this stroke, the plugin does not draw the stroke. Is this possible ?

Thanks

Il giorno 9 set 2022, alle ore 17:28, Alex @.***> ha scritto:

Yes. Suppose you have a set of points, you could simply do the following

const points = [51.65464, 14.5756], [51.5785, 14.87575]; // your coordinates const line = new L.Polyline(points); line.addTo(map); or if you want routing, you could use something like this

L.Routing.control({

waypoints: [

L.latLng(57.74, 11.94),

L.latLng(57.6792, 11.949)

], }).addTo(map); although I'm not sure, how accurate the result would be since cableways are not usually included in OSRM routes as far as I know

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

curtisy1 commented 1 year ago

Is it possible that you show me some sample code of what you want to achieve? I'm still not sure whether you really want all the routing overhead when you know your waypoints and could just create a route between them