perliedman / leaflet-routing-machine

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

Support OSRM's trip API #213

Open perliedman opened 8 years ago

perliedman commented 8 years ago

As suggested in https://github.com/perliedman/leaflet-routing-machine/issues/203#issuecomment-177430492.

kirantpatil commented 7 years ago

:100: :+1:

So, with this api support will it show all possible trips as mentioned in the osrm project ?

Trip service

The trip plugin solves the Traveling Salesman Problem using a greedy heuristic (farthest-insertion algorithm). The returned path does not have to be the fastest path, as TSP is NP-hard it is only an approximation. Note that if the input coordinates can not be joined by a single trip (e.g. the coordinates are on several disconnected islands) multiple trips for each connected component are returned.

perliedman commented 7 years ago

There's no clear plan at this point. It's only a suggested feature.

Help getting this done, in the form of a PR, or sponsorship for developing it would be welcome.

zf6578 commented 6 years ago

hello, i have set up osrm demo server. and i already have the respond json from match service,so,how could i use the lrm draw this ponits in demo web,

1ec5 commented 1 year ago

As far as I can tell, the trip service has a response format identical to route, except that each Waypoint object in waypoints has a trips_index property, and the routes property is called trips instead (but still holds Route objects). The request options are similar too. So I suspect this is just a matter of falling back to response.trips if there’s no response.routes:

https://github.com/perliedman/leaflet-routing-machine/blob/04e899ea765cadae033d941e9de13846540ce69b/src/osrm-v1.js#L161-L162