Getting graphhopper to work

I’ve been having a really rough time getting graph-hopper to work. My most recent attempt involved trying the quickstart to be found here - https://github.com/graphhopper/graphhopper/blob/master/docs/web/quickstart.md

Having thought about it for a while, I am guessing that one problem was the absence of the config-example.yml file. Where can I get this file?

Thanks,

  • bpp

Once you have java installed, you should just be able to run commands similar to the following in the command prompt to get it to work locally.

cd ‘C:~directory with graphhopper files’
start chrome http://localhost:8989/
java -jar *.jar jetty.resourcebase=webapp config=config-example.properties osmreader.osm=berlin-latest.osm.pbf

‘*’ = filename e.g. graphhopper-web-0.5.0-with-dep.jar

Hey, thanks! I didn’t get an error this time. I got the following:

“2018-08-17 12:23:34,692 [main] INFO com.graphhopper.http.CmdArgsModule - jsonp disabled
2018-08-17 12:23:35,199 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - version 0.10.0|2018-03-02T07:40:33Z (5,14,4,3,3,2)
2018-08-17 12:23:35,209 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - graph CH|car|RAM_STORE|2D|NoExt|, details:edges:0(0MB), nodes:0(0MB), name:(0MB), geo:0(0MB), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348623157E308,-1.7976931348623157E308, CHGraph|fastest|car, shortcuts:0, nodesCH:(0MB)
2018-08-17 12:23:35,233 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - start creating graph from manhattan.osm_01.osm
2018-08-17 12:23:35,233 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - using CH|car|RAM_STORE|2D|NoExt|, memory:totalMB:115, usedMB:32
2018-08-17 12:23:38,827 [main] INFO com.graphhopper.reader.osm.OSMReader - creating graph. Found nodes (pillar+tower):17á018, totalMB:205, usedMB:121
2018-08-17 12:23:40,498 [main] INFO com.graphhopper.reader.osm.OSMReader - 467á024, now parsing ways
2018-08-17 12:23:41,758 [main] INFO com.graphhopper.reader.osm.OSMReader - 533á201, now parsing relations
2018-08-17 12:23:41,844 [main] INFO com.graphhopper.reader.osm.OSMReader - finished way processing. nodes: 6045, osmIdMap.size:17054, osmIdMap:0MB, nodeFlagsMap.size:36, relFlagsMap.size:0, zeroCounter:36 totalMB:329, usedMB:144
2018-08-17 12:23:41,850 [main] INFO com.graphhopper.reader.osm.OSMReader - time pass1:3s, pass2:3s, total:6s
2018-08-17 12:23:41,854 [main] INFO com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks - start finding subnetworks (min:200, min one way:200) totalMB:329, usedMB:144
2018-08-17 12:23:41,961 [main] INFO com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks - car findComponents time:0.10303182, size:228
2018-08-17 12:23:41,987 [main] INFO com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks - 459 subnetworks found for car, totalMB:329, usedMB:145
2018-08-17 12:23:41,993 [main] INFO com.graphhopper.routing.subnetwork.PrepareRoutingSubnetworks - optimize to remove subnetworks (459), unvisited-dead-end-nodes (515), maxEdges/node (6)
2018-08-17 12:23:42,014 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - edges: 9858, nodes 5587, there were 459 subnetworks. removed them => 458 less nodes
2018-08-17 12:23:42,096 [main] INFO com.graphhopper.storage.index.LocationIndexTree - location index created in 0.0744618s, size:9á263, leafs:1á111, precision:300, depth:3, checksum:5587, entries:[64, 16, 4], entriesPerLeaf:8.337534
2018-08-17 12:23:42,137 [main] INFO com.graphhopper.routing.ch.CHAlgoFactoryDecorator - 1/1 calling CH prepare.doWork for fastest|car … (totalMB:329, usedMB:149)
2018-08-17 12:23:42,231 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 0, updates:0, nodes: 5á587, shortcuts:0, dijkstras:22á169, t(dijk):0.02, t(period):0.0, t(lazy):0.0, t(neighbor):0.0, meanDegree:1, algo:0MB, totalMB:329, usedMB:152
2018-08-17 12:23:42,347 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 1á100, updates:0, nodes: 4á487, shortcuts:1á215, dijkstras:25á305, t(dijk):0.07, t(period):0.0, t(lazy):0.0, t(neighbor):0.04, meanDegree:1, algo:0MB, totalMB:329, usedMB:152
2018-08-17 12:23:42,634 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 2á200, updates:1, nodes: 3á387, shortcuts:3á175, dijkstras:52á608, t(dijk):0.3, t(period):0.18, t(lazy):0.0, t(neighbor):0.09, meanDegree:1, algo:0MB, totalMB:329, usedMB:154
2018-08-17 12:23:42,887 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 3á300, updates:2, nodes: 2á287, shortcuts:5á899, dijkstras:80á758, t(dijk):0.48, t(period):0.3, t(lazy):0.0, t(neighbor):0.15, meanDegree:2, algo:0MB, totalMB:329, usedMB:154
2018-08-17 12:23:43,217 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 4á400, updates:3, nodes: 1á187, shortcuts:9á394, dijkstras:115á496, t(dijk):0.75, t(period):0.42, t(lazy):0.0, t(neighbor):0.26, meanDegree:4, algo:0MB, totalMB:329, usedMB:156
2018-08-17 12:23:43,730 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - 5á500, updates:4, nodes: 248, shortcuts:12á793, dijkstras:167á375, t(dijk):1.21, t(period):0.55, t(lazy):0.06, t(neighbor):0.47, meanDegree:6, algo:0MB, totalMB:329, usedMB:156
2018-08-17 12:23:43,941 [fastest_car] INFO com.graphhopper.routing.ch.PrepareContractionHierarchies - took:1, new shortcuts: 13á905, prepare|fastest, dijkstras:195011, t(dijk):1.4, t(period):0.59, t(lazy):0.11, t(neighbor):0.55, meanDegree:1, initSize:5587, periodic:20, lazy:10, neighbor:20, totalMB:329, usedMB:156
2018-08-17 12:23:43,942 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - flushing graph CH|car|RAM_STORE|2D|NoExt|5,14,4,3,3, details:edges:9á858(1MB), nodes:5á587(1MB), name:(1MB), geo:18á296(1MB), bounds:-74.0410013,-73.90694168747086,40.7002231,40.878186543543336, CHGraph|fastest|car, shortcuts:13á905, nodesCH:(1MB), totalMB:329, usedMB:156)
2018-08-17 12:23:44,072 [main] INFO com.graphhopper.reader.osm.GraphHopperOSM - flushed graph totalMB:329, usedMB:160)
2018-08-17 12:23:44,078 [main] INFO com.graphhopper.http.GraphHopperModule - loaded graph at:manhattan.osm_01-gh, data_reader_file:manhattan.osm_01.osm, flag_encoders:car, edges:9á858(1MB), nodes:5á587(1MB), name:(1MB), geo:18á296(1MB), bounds:-74.0410013,-73.90694168747086,40.7002231,40.878186543543336, CHGraph|fastest|car, shortcuts:13á905, nodesCH:(1MB)
2018-08-17 12:23:45,598 [main] INFO com.graphhopper.http.GHServer - Started server at HTTP :8989”

but when I went to " http://localhost:8989/" I got:

"
{
“message” : “Not found”
}
"

Any ideas of how to make it work from this point?

Thanks again,

  • bpp

I didn’t try running the jar directly, however I was able to get it running using one of the following methods, in case you aren’t aware of them:

  • docker: see the readme
  • from source: see this doc. The ./graphhopper.sh cli is a neat starting point.

Otherwise the config-example.yml (note the .yml the .properties is no longer supported I think) is available at the root of the repository.

I hope this helps.

In general it is better to use the last stable version and documentation:

It should redirect you automatically to /maps … if not something is wrong that we have to fix

Finally got it working on Windows (thanks maxo16):
C:\GraphHopper>java -jar graphhopper-web-0.10.0-with-dep.jar jetty.resourcebase=webapp config=config-example.properties datareader.file=berlin-latest.osm.pbf
BTW, would be really nice if someone could please post this into the quick start doc:
https://github.com/graphhopper/graphhopper/blob/master/docs/web/quickstart.md
The link http://localhost:8989/ brought up map of Berlin for me, everything seems to be fine.