Request large number of routes

Let’s say we have 600.000 possible route combinations. How can one efficiently request a local Graphhopper server to get routing data for each single route. I am using the Routing API for this so far and I am iterating route by route which is apparently to slow for this size. Since the Matrix API seems not to be part of the open source repository, is there another way or more faster way to fetch the route informations at this scale?

Are you making use of R or python for this?

Thanks for the hint with async and multithreading. I tried to use the library grequests and it needs also quite long to fetch 10000 requests. I will try to use multithreading as next option.


Please let me know if you or anyone has a code for R on this.

What is a CH prepared server?
I am using the default config.yml file and the map (europe) is stored in ram.
So guessing it is the speed mode:

  # By default the speed mode with the 'fastest' weighting is used. Internally a graph preparation via
  # contraction hierarchies (CH) is done to speed routing up. This requires more RAM/disc space for holding the
  # graph but less for every request. You can also setup multiple weightings, by providing a comma separated list. fastest

I think there is no faster option for requesting Graphhopper (except for mentioned matrix api). The multithreading way accelerates it slightly but still too slow and the asynchronous way with “aiohttp” aborts for more than 10k requests, although it is quite fast for less than 10k requests. I might try to use the chunk strategy as next.

Btw: the problem has been solved. Multithreading was the solution.

1 Like