How to Quickstart Graphhopper with my own multimod

2020-06-29 02:37发布

问题:

I would like to implement my own routing web service in play framework (due to the fact that it's java and it's a rapid prototyping framework). I also would like to use graphhopper as the routing engine.

My Basic requirements are:

  • The routing should be based on our own multimodal graph database (consisting of EDGES/LINKS and NODES and also different properties to derive weights from
  • I want to be able to select different properties for edge weighting during runtime (i.e. an emergency vehicle can take routes, normal cardrivers aren allowedto use)
  • The graph spreads over half the size of austria (approx. 800.000 edges).

At the moment I have a lot of questions, and don't really know where to begin:

  1. Is the transport vehicle type defined with EncodingManager only, or is it possible to change it during a route? (without rebuilding the graph while runtime)
  2. Whats exactly the difference between RAMDataAccess and MMapDataAccess? Does the latter mean, that the graph is (partly) stored on disc? Does the first mean the graph is only stored in Memory?
  3. I dont understand the NextA and NextB Properties of the EDGE object...what about crossings with 3 or more EDGEs? Which one is NextB from each of the other ones?
  4. Does "...where nodeA is always smaller than nodeB..." mean that the ID has always to be smaller? What about graph direction (i.e. an EDGE pointing to the other direction)?
  5. More questions to come up....

What I did so far:

  • I was going through the graphhopper docs starting with the developer snippets and the low level API but on th page it says that this is outdated?!?! (What does that mean?)

  • I also checked the web subfolder of the graphhopper github repository, but there is only a ready-to-use graphhopper webservice based on OSM data built in there.

  • Unfortunately I could not find any more comprehensive example including building a graph with MMapDataAccess (edit thanks for the tip to look into the unit tests, I think I'll find mor there)

I'd be very grateful to anybody here, who could please give me some examples how to build up my own graph and use (or rebuild it?) when weighting parameters change.

EDIT: tried to make my points clearer

回答1:

select different properties for edge weighting during runtime out of our database

If you want to select the weighting at runtime you should avoid triggering an external database. It will slowdown everything. Instead feed the weights you have into the GraphHopperStorage itself. Every edge is a row in a big table. Just add one more column per weight you need:

E_CUSTOM_WEIGHT = nextEdgeEntryIndex();

The graph spreads over half the size of austria (approx. 800.000 edges)

Not sure what you mean with multimodal graph (also timedependent?). If normal road network 800k is not much. Whole germany is ten times large and fits into under 1gb

Regarding quickstart. Just the wiki for the low level API is outdated. Have a look into the unit tests of LocationIndexTree for the current usage. (maybe you can update the wiki afterwards :))

Unfortunately I could not find any more comprehensive example including building a graph with MMapDataAccess.

you just change the config or if you prefer low level API:

graph = new GraphHopperStorage(new MMapDirectory(), encodingManager)

Anybody here can give me some examples how to build up my own graph and rebuild it,when weighting parameters change.

have a look into the unit tests. Lots of examples how to build a graph. With 'rebuilding' - what do you mean? Do you mean the CH preparation? CH preparation is not possible if you want to calculate weight at runtime.