Routing API with avoid options

Dear forum users,

We need the planet OSM file for our self-hosted Graphhopper environment. Receiving a route calculation within reasonable time (under 1 second), requires us to utilize contraction hierarchies. However, doing so removes the ability to enable avoid options like highways and toll roads.

What other options are there to achieve a optimized query speed while remaining functionality?

We are currently working on making CH more flexible, but this will take some time until it is fully functional. What kind of avoid options are you hoping to realize ? If you just need different setups for vehicles that can or cannot route on highways you can use multiple CH preparations for the different cases. Are you trying to avoid e.g. all highways or are you trying to avoid certain highways / toll roads only (on a per-request basis) ?

1 Like

Depending on the route length this is doable with landmarks: Now flexible routing is at least 15 times faster - GraphHopper Directions API

When preparing a route to ride on my bike, I don’t want any highways or toll roads in my route (or at least as little as possible).
That is why I use the ‘ch.disable=true’ option combined with ‘avoid=motorway;toll’.
That is what I want. But the server response is very slow.
Hope this explanation helps!

This sounds like all you need is a CH preparation for the bike profile then. Use graph.encoders=car,bike in your settings and specify vehicle=car/bike in your query (in case you want to make queries for cars (including highways) and bikes (excluding highways).

Thanks for your suggestion, but I don’t think this is what I need, because without the ‘ch.disable=true’ option the calculation is too slow (answer from server takes to much time).

You do not need to set ch.disable=true. You can use CH with car and bike.

This is a classic example of miscommunication, I think. :slight_smile:
What I meant was “motorcycle,” not just a bike without a motor.

I apologize for my part in this miscommunication.
But the problem is still there! And so is my question.

You can just as well specify graph.encoders=car,motorcycle (?). Sorry maybe I did not understand your question so far.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.