GraphHopper Locus Map add-on

I read of GraphHopper version 0.1.8 in Locus Map Help Desk. I use the GraphHopper add-on version 0.1.7 by courtesy of a topic in Locus Map forum, a link in which takes me to Google Drive. I guess routing data must be updated continually to keep abreast of changes and additions. I wonder where later versions and their update information are available, and how one can be advised or know of updates?

If you find out which GraphHopper version the add-on is using you can easily create routing data yourself. Probably 0.4.1 then install java, fetch the GH repo from github, do git checkout 0.4 and create the data via ./ import your-area.pbf and the data is placed in the folder your-area-gh now you need to package this, but I do not know the details about this. Maybe you ask this in the locus forum? See here for some details about this development.

What a shame! I had got so far with my very limited knowledge but have reached the point, probably, where I can go no further:
Locus Map’s administrator, Menion, had created ‘’ on Google Drive and posted the following on its forum:
"How to generate routing files

  • Download the raw openstreetmap file (pbf files)
  • Execute ./ import . This creates the routing data"
    I came to understand a .sh file is used primarily, if not exclusively, in Unix. I work with Windows, only. I learnt of Cygwin. I installed it and ran it with what I hoped was the correct command. Having overcome the initial absence of a server folder and jvm.dll file, this followed:
    $ ./ import luxembourg.osm.pbf
    using java 1.8.0_60 from
    using existing osm file luxembourg.osm.pbf
    ./ line 82: mvn: command not found
    No Maven found in the PATH. Now downloading+installing it to ./maven
    ./ line 90: wget: command not found
    ./ line 91: unzip: command not found
    mv: cannot stat ‘apache-maven-3.2.5’: No such file or directory
    rm: cannot remove ‘’: No such file or directory
    existing jar found tools/target/graphhopper-tools-0.5-SNAPSHOT-jar-with-dependencies.jar
    now import. JAVA_OPTS=-Xmx10200m -Xms1024m -server
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit.
    Invalid maximum heap size: -Xmx10200m
    The specified size exceeds the maximum representable size.

Ah! well, I give myself 8/10 for trying!

1 Like

Thanks for trying :slight_smile:

For users this procedure might be simpler where you don’t need cygwin. Or alternative install the missing the packages for wget and unzip, see here for more infos but again the first procedure should be simpler. Make then sure you use the correct GraphHopper version. E.g. the old 0.4 description is here

Well, I almost got there! I used your ‘this procedure’ link and followed the Quickstart instructions. I had downloaded luxembourg-latest.osm.pbf from as a test because it was a small file. There was one setback at this point: I believed I could enter *.jar as written but the command would not run properly. Entering graphhopper-web-0.4.1-with-dep.jar instead did work, however. To my delight I obtained ‘Started server at HTTP :8989’ and a luxembourg.osm-gh file! All I had to do now was download the england.osm.pbf and I was home and dry. Wrong! I received this message part way through:
2015-10-27 18:33:00,967 [main] INFO com.graphhopper.reader.OSMReader - creating
graph. Found nodes (pillar+tower):11á561á669, totalMB:247, usedMB:242
Exception in thread “PBF Reader” Exception in thread “main” java.lang.RuntimeExc
eption: Unable to read PBF file.
at Source)
Caused by: java.lang.RuntimeException: java.lang.InterruptedException
at com.graphhopper.reader.OSMInputFile.process(
I have downloaded and run Wales and Scotland successfully. I have tried England again with the same error. I shall not give up at this point when you have got me so close, but does the extract give you a clue?

Nice that you’ve gotten to some progress! Would you include the full stacktrace (preferable formatted) here?

Also please re-download tomorrow again and make sure you remove the england-…-gh folder before importing again.

I thank you for your prompt reply. Is this OK?
C:\Users\Bob\Downloads\GraphHopper_2\graphhopper-web-0.4.1-bin>java -jar graphhopper-web-0.4.1-with-dep.jar jetty.resourcebase=webapp osmreader.osm=england-latest.osm.pbf
2015-10-27 20:16:32,080 [main] INFO com.graphhopper.GraphHopper - version 0.4.1|2015-03-18T17:36:20+0000 (4,12,3,2,2)
2015-10-27 20:16:32,096 [main] INFO com.graphhopper.GraphHopper – graph LevelGraphStorage|car|RAM_STORE|2D|NoExt|, details:edges:0(0), nodes:0(0), name: /(0), geo:0(0), bounds:1.7976931348623157E308,-1.7976931348623157E308,1.7976931348 623157E308,-1.7976931348623157E308
2015-10-27 20:16:32,111 [main] INFO com.graphhopper.GraphHopper - start creating graph from england-latest.osm.pbf
2015-10-27 20:16:32,111 [main] INFO com.graphhopper.GraphHopper - using LevelGraphStorage|car|RAM_STORE|2D|NoExt|, memory:totalMB:15, edMB:4
2015-10-27 20:17:30,319 [main] INFO com.graphhopper.reader.OSMReader - 50á000 (preprocess), osmWayMap:0 totalMB:247, usedMB:214
2015-10-27 20:17:30,678 [main] INFO com.graphhopper.reader.OSMReader - 100á000(preprocess), osmWayMap:0 totalMB:247, usedMB:243
2015-10-27 20:17:30,772 [main] INFO com.graphhopper.reader.OSMReader - creating graph. Found nodes (pillar+tower):11á561á669, totalMB:247, edMB:172
Exception in thread “PBF Reader” Exception in thread “main” java.lang.RuntimeException: Unable to read PBF file.
at Source)
Caused by: java.lang.RuntimeException: java.lang.InterruptedException
at com.graphhopper.reader.OSMInputFile.process(
at com.graphhopper.reader.pbf.PbfDecoder.sendResultsToSink(
at com.graphhopper.reader.pbf.PbfDecoder.processBlobs(
… 1 more
Caused by: java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(Unknown Source)
at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(Unknown Source)
at java.util.concurrent.LinkedBlockingQueue.put(Unknown Source)
at com.graphhopper.reader.OSMInputFile.process(
… 5 more
java.lang.OutOfMemoryError: Java heap space at
at gnu.trove.impl.hash.THash.postInsertHook(
at com.graphhopper.reader.OSMReader.processNode(
at com.graphhopper.reader.OSMReader.writeOsm2Graph(
at com.graphhopper.reader.OSMReader.readGraph(
at com.graphhopper.GraphHopper.importData(
at com.graphhopper.GraphHopper.process(
at com.graphhopper.GraphHopper.importOrLoad(
at com.graphhopper.http.DefaultModule.createGraphHopper(
at com.graphhopper.http.DefaultModule.configure(
at com.graphhopper.http.GHServer$1.configure(
at com.graphhopper.http.GHServer.start(
at com.graphhopper.http.GHServer.main(

You need to increase the heap for the JVM. Add the following -Xmx1g -Xms1g when you run the import (or in your case the jar) e.g. java -Xmx1g -Xms1g ...

BTW: When using the you’d do

export JAVA_OPTS="-Xmx1g -Xms1g"
./ import your.pbf

Success! I do not understand your BTW (yes, I do, now that I read my second post) but I believe I have what I need for my purposes in the england-latest.osm-gh folder and its contents. I copy it into Locus>mapsVector on my mobile 'phone.
I thank you very much for providing me with the necessary information, your patience and prompt attention to help me out of my difficulties. I feel immensely satisfied!
PS The .osm-gh file created successfully using the Quickstart instructions with your help and graphhopper-web-0.4.1-bin was not liked by Locus Map. The .osm-gh file created successfully because of your considerate BTW and using Menion’s generator is liked by Locus Map. So, I thank you doubly!

1 Like