1

We are looking at using graph hopper for one of our projects. In this regard, given point A and point B, we wanted to get top 10 different routes in the ascending order of transit time. Does graph hopper support this out of the box and yes, what API I should use?

Thanks

BASS
  • 21
  • 1

1 Answers1

1

This is currently only possible in a development branch, there is no released version. See this issue where the round trip feature is implemented via 'alternative routes'. Also it has some quality and feature limitations like it is only possible without CH. But with some more effort all should be possible.

Karussell
  • 17,085
  • 16
  • 97
  • 197
  • Thank you so much for response. I will checkout development branch and check it out. Few basic questions ( just to be clear on my part). 1. I need to pass two points and api.alternatives.max. 2. It returns me list of alternate routes ( size same number as I passed in step1). However every alternate route contains multiple paths. As long as these paths are correct and honors start point and end point via possible edges, I can give my input parameter as ( alternate route = 1) and can live with that as I am interested in lower level paths. Kindly confirm. – BASS Jul 26 '15 at 15:42
  • In the branch indeed no API refactoring is done and therefor you are right that only the hopper.getPaths method is correct but not the resulting GHResponse as these paths are incorrectly merged then into one resulting in a bit strange JSON for example. But as you need on the lower level paths you should be fine. Feel free to propose a pull request for your changes to this branch. – Karussell Jul 27 '15 at 08:33
  • I already did a simple sample and following are my observation – BASS Jul 27 '15 at 13:33
  • Sorry pressed return before I could complete. Here is my sample code – BASS Jul 27 '15 at 16:32
  • My sample codeGraphStorage graph = new GraphBuilder(encodingManager).setLocation(location).create(); NodeAccess na = graph.getNodeAccess(); na.setNode(0, 42, 10); na.setNode(1, 42.1, 10.1); na.setNode(2, 42.1, 10.2); na.setNode(3, 42, 10.4); na.setNode(4, 41.9, 10.2); graph.edge(0, 3, 40, true); graph.edge(0, 1, 10, true); graph.edge(1, 2, 15, true); graph.edge(2, 3, 10, true); graph.edge(0, 4, 15, true); graph.edge(4, 3, 20, true); graph.edge(1, 3, 25, true); – BASS Jul 27 '15 at 17:01
  • I am trying to get the route from node0 to node 3 and expected paths are 4 (0-3,0-1-2-3,0-4-3,0-1-3). However the program always returns only two paths Paths.size = 2 path detailsdistance:35.0, edges:2, found:true, 1->6 path detailsdistance:35.0, edges:2, found:true, 4->5 If I comment one of the edge, it gives another path. Not sure why. Will further debug (My hunch is some other parameters related to alternate.max need to be set as well). Some times it returns only one path (if all paths distance are same). – BASS Jul 27 '15 at 17:02
  • My expected output is to get 4 possible paths and am not sure whether other parameters need to be tweaked – BASS Jul 27 '15 at 17:02