Waypoint Order - Graphhopper Web

Hello,
I am currently using the graphhopper Web JAR, with a modified Mapbox nav+UI for Android.

This uses the endpoint: GET /navigate/directions/v5/gh/{profile}/{coordinatesArray : .+} (com.graphhopper.navigation.NavigateResource)

Worked so far with an origin and a destinatin. Now i wanted to add Waypoints.
What i want: That the order with which the waypoints are visited is in the same order.
What i get: Graphhopper optimizes the route and therefor changes the order of the waypoint visits.

Without using the Web API i would go for a workaround and make several GHRequests and stick together the results in Order. But how to achieve this with the Web API?

There is no optimization including in the routing engine so maybe there is some other error happening here?

btw: for a more recent android navigation UI you should have a look into this issue.
btw2: if you have a few minutes may I ask you to try my highly experimental in-browser navigation branch :smiley: ? (Click on the arrow of a route to start navigation. Link to code)

Thanks. Then i am now sure that i got confused at some point by the Camera Follow mode and the automatic rotation and interpreted the result wrong.
Could not reproduce this “optimization” … because it never happened.

regarding 1.) Already went for the last version with MIT license (0.19 or something like that) and fully changed it to be compatible with AndroidX instead of old support libs and compatibility with the newest Mapbox Libs because we use them anyways heavily in the rest of the app

regarding 2.) Never mocked location on desktop browser, so tried on a Motorola GSomething in Chrome. Looks nice and already with voice instructions. Sad that this is not release … would use it :frowning:
And i guess as it is experimental: OffRoute detection and behaviour is not implemented yet right?

And a follow up question:

With the Web API it seems, one Route comes back and that’s that.

With the GHRequest there is the option to calculate alternative Routes.

Is there a way to calculate routes with GHRequest, present the user to pick one and then use this route as some kind of “bias” for the actual Turn by Turn navigation with /navigate/directions/v5/gh/ ?

Or is the only solution/hack to somehome use the picked route as waypoints (or at least some points of it) ?

Ah, nice. If you like to contribute your changes let me know :slight_smile:

And i guess as it is experimental: OffRoute detection and behaviour is not implemented yet right?

Great to hear that you like it. But yes, it is experimental for several reasons. The main one is that before we add features we would like to get rid of known bugs. We currently face a serious performance problem for firefox&mapbox GL JS we need to fix or workaround this first, because changing the route while navigation makes this problem even worse. Although for mobile browser I saw this “perf lagging” problem only once and likely when using chrome this won’t happen at all.

Never mocked location on desktop browser

Soon you can replay a route via providing two locations and append &fake=true :slight_smile: (we then inject some slightly randomized GPS locations along the route)

Is there a way to calculate routes with GHRequest, present the user to pick one and then use this route as some kind of “bias” for the actual Turn by Turn navigation with /navigate/directions/v5/gh/ ?

I’m currently unsure how we implemented that. Likely @boldtrn knows more :slight_smile:

In theory the nav sdk can handle alternative routes and in theory GraphHopper can calculate alternative routes. If I remember correctly (it has been a bit of time since I touched that code) the /navigate endpoint currently does not support alternative routes, but it should be “relatively easy” to add this (I guess a PR would be welcome :slight_smile:).

If you are looking for something else, like calculate multiple routes and a user just chooses one, that should be possible with custom client code.

Ok thanks. “Relatively easy”: So i only have to find time to stir around in the code more :slight_smile:

Powered by Discourse