leaflet-routing-machine icon indicating copy to clipboard operation
leaflet-routing-machine copied to clipboard

Support OSRM's trip API

Open perliedman opened this issue 9 years ago • 4 comments

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

perliedman avatar Mar 11 '16 12:03 perliedman

: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.

kirantpatil avatar Dec 23 '16 11:12 kirantpatil

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.

perliedman avatar Dec 23 '16 15:12 perliedman

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,

zf6578 avatar Nov 23 '17 02:11 zf6578

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

1ec5 avatar Jun 13 '23 21:06 1ec5