Installing Graphhopper on a Windows Server

I’m looking for advice on installing the Graphhopper routing engine on a Windows server. I’ve tried following the Quick Start instructions (https://github.com/graphhopper/graphhopper/blob/0.5/docs/web/quickstart.md) but get stuck at step 3, when I try to start Graphhopper Maps. I get the following error message:

“If no graph.location is provided you need to specify an OSM file”

This is the command I’m running:

java -jar C:\Graphhopper\graphhopper-web-0.10-0-with-dep.jar jetty.resourcebase=webapp config= C:\Graphhopper\config-example.properties datareader.file= C:\Graphhopper\berlin-latest.osm.pbf

I’ve already changed the parameter “osmreader.osm” as it gave an error message saying that this has been replaced with the parameter “datareader.file”. I have the file “berlin.latest.osm.pbf” in the specified folder.

Can anyone help?

Thanks,

John

Sorry, my mistake - I had a rogue space character in the command!

1 Like

I’ve progressed a bit further with this but I’ve hit another stumbling block!

When I run the java command to build the graph for planet-latest.osm.pbf it gets so far then gets stuck, despite leaving it running for 24 hours. I’m using a Dell PowerEdge R710 windows server with 96GB of RAM and 2 x 3.06GHz Hex-Core processors, so I’m guessing this is powerful enough to do the job, as the server isn’t being used for any other tasks. At one point in messages being output it says “OutOfMemoryError: Java heap space” but there is plenty of memory on the server, so I don’t know if this is just a spurious warning message.

When I run the java command with the berlin-latest-pdf fiile it runs successfully in under a minute. Any ideas of what might be going wrong?

You need to increase the -Xmx setting. See a few more tips here https://github.com/graphhopper/graphhopper/blob/master/docs/core/deploy.md

Thanks. I tried adding “-Xmx17000m -Xms17000m” to the java command, which is what was suggested for worldwide coverage, but it gave the following error:

Invalid maximum heap size: -Xmx17000m
The specified size exceeds the maximum representable size.

It looks like the latest error was due to me using the 32Bit version of Java instead of the 64Bit version! I’ve reinstalled Java so fingers crossed!

1 Like

I’ve added “-Xmx17000m -Xms17000m” to the java command. It runs for longer but I’m still getting OutOfMemory errors. Is it a case of trial and error with these settings (increasing them from 17000 until it runs OK), or is there a value at which it should always work?

The rule of thumb is to look how much space the folder uses on your disc and then add 2GB or a bit more depending on the actual volume and usage or … just use 80% of the server capacity :wink:
(It is recommended to keep Xmx under 95% of the server RAM if there are no other services on it)

I managed to get it to work with -Xmx and -Xms set to 70000m. It took 16 hours to generate a worldwide graph for single profile (car) and 61 hours to generate one for 3 profiles (car, hike and mtb)! This was on a machine with 96GB of RAM and 2 x 3.06 GHz Hex-Core processors. Is there anything I can do to speed up the graph generation?

I’m only interested in the shortest routes (not the fastest) so I’m using prepare.ch.weightings=shortest but I wasn’t sure if there were any other settings I could change that were slowing things down unnecessarily. I would appreciate any advice?

Thanks.

John

You can calculate the 3 profiles in parallel. But this might require even more RAM.

I’m only interested in the shortest routes (not the fastest)

We highly recommend against shortest. Shortest often does not make sense, especially for car or mtb/bike where you have several things to consider for the usual best route.

(And also shortest might compile slower due to reduced hierarchy)

I’ve managed to get it up and running successfully! Thanks for your help. I’ve stuck with the Shortest profile for now - this works well in my use case as people are plotting routes by hand, with only a very short distance between the points, typically less than 500m.

There is one more thing I’m struggling with. I’m not sure what settings I need to use in the config file to be able to support the “avoid” parameter in requests. Requests with this parameter fail with my current settings.

What error message do you get? You have to disable CH to make this working, and so either LM or slower A* will be used.

I get message “Disabling CH not allowed on the server-side” if I add “&ch.disable=true&avoid=motorway” to the request. If I leave out “ch.disable=true” but still include “avoid=motorway” it seems to accept this but still routes on a motorway even though there is an alternative of a similar distance.

You can allow “disabling CH” on the server side via:

routing.ch.disabling_allowed=true

or for master (>=0.11) und the graphhopper: section do:

routing.ch.disabling_allowed: true

(to make this effective - just restart GH)

I’ve added “routing.ch.disabling_allowed=true” to the config file and rebuilt the graph. I don’t get the error message “Disabling CH not allowed on the server-side” anymore but the avoid motorway parameter doesn’t seem to have any effect. Does this work the the “shortest” profile or only with “fastest”?

Sorry, I forgot that this feature is currently only implemented in our EE service (not really to hide it to make money, but to hide it as it is a bit ugly and we don’t want to support that in our open source software, where we plan a better infrastructure for these features).

Please have a look into the DataFlagEncoder where you can use the highwayEncoder to store the road type and then avoid it in your custom Weighting, see GenericWeighting.

what is config file?

when I reboot the server, i still get the same question, how you do it? I just comment the routing.ch.disabling_allowed = true in the config .yml, but there shows the Disabling CH not allowed on the server-side.