There might be a small error in the ‘java usage’ section of the map-matching and the Routing via Java API page. In both instances setOSMFile(osmFile) is being called on a GraphHopper object while this function only exists in its subclass GraphHopperOSM.
Current (map matching):
GraphHopper hopper = new GraphHopper();
Current (Routing via Java API in graphhopper/docs/core/routing.md)
GraphHopper hopper = new GraphHopperOSM().forServer();
GraphHopperOSM hopperOSM = new GraphHopperOSM();
GraphHopper hopper = hopperOSM.forServer();
My apologies if I am simply misunderstanding or overlooking something.
That is correct and is already fixed
Thanks for pointing this out!
Ups, this was not properly fixed (will do in a sec) … we need a compiler for the docs https://github.com/graphhopper/graphhopper/issues/774#issuecomment-246299037 Maybe someone knows a solution for this?
It does indeed seem that a compiler for the docs would be very useful, the map matching constructor used in the example seems to be outdated:
GraphHopperStorage graph = hopper.getGraphHopperStorage();
LocationIndexMatch locationIndex = new LocationIndexMatch(graph,
MapMatching mapMatching = new MapMatching(graph, locationIndex, encoder);
Instead this should probably be something like this?
String algorithm = Parameters.Algorithms.DIJKSTRA_BI;
Weighting weighting = new FastestWeighting(encoder);
AlgorithmOptions algoOptions = new AlgorithmOptions(algorithm, weighting);
MapMatching mapMatching = new MapMatching(hopper, algoOptions);
Thanks for finding this (will have a look), would love to have a proper solution, but see the issue - it does not seem to be that simple.