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 ./graphhopper.sh 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 ‘generator_0.1.7.zip’ on Google Drive and posted the following on its forum:
"How to generate routing files

  • Download the raw openstreetmap file (pbf files)
  • Execute ./graphhopper.sh 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:
    $ ./graphhopper.sh import luxembourg.osm.pbf
    using java 1.8.0_60 from
    using existing osm file luxembourg.osm.pbf
    ./graphhopper.sh: line 82: mvn: command not found
    No Maven found in the PATH. Now downloading+installing it to ./maven
    ./graphhopper.sh: line 90: wget: command not found
    ./graphhopper.sh: line 91: unzip: command not found
    mv: cannot stat ‘apache-maven-3.2.5’: No such file or directory
    rm: cannot remove ‘maven.zip’: 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

karussell
Well, I almost got there! I used your ‘this procedure’ link and followed the Quickstart instructions. I had downloaded luxembourg-latest.osm.pbf from http://download.geofabrik.de/europe.html 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 com.graphhopper.reader.pbf.PbfReader.run(PbfReader.java:53)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.InterruptedException
at com.graphhopper.reader.OSMInputFile.process(OSMInputFile.java:265)
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 config=config-example.properties 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 com.graphhopper.reader.pbf.PbfReader.run(PbfReader.java:53)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.InterruptedException
at com.graphhopper.reader.OSMInputFile.process(OSMInputFile.java:265)
at com.graphhopper.reader.pbf.PbfDecoder.sendResultsToSink(PbfDecoder.java:106)
at com.graphhopper.reader.pbf.PbfDecoder.processBlobs(PbfDecoder.java:171)
at com.graphhopper.reader.pbf.PbfDecoder.run(PbfDecoder.java:184)
at com.graphhopper.reader.pbf.PbfReader.run(PbfReader.java:49)
… 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(OSMInputFile.java:262)
… 5 more
java.lang.OutOfMemoryError: Java heap space at gnu.trove.map.hash.TLongLongHashMap.rehash(TLongLongHashMap.java:182)
at gnu.trove.impl.hash.THash.postInsertHook(THash.java:388)
at gnu.trove.map.hash.TLongLongHashMap.doPut(TLongLongHashMap.java:222)
at gnu.trove.map.hash.TLongLongHashMap.put(TLongLongHashMap.java:198)
at com.graphhopper.reader.OSMReader.processNode(OSMReader.java:569)
at com.graphhopper.reader.OSMReader.writeOsm2Graph(OSMReader.java:289)
at com.graphhopper.reader.OSMReader.readGraph(OSMReader.java:150)
at com.graphhopper.GraphHopper.importData(GraphHopper.java:662)
at com.graphhopper.GraphHopper.process(GraphHopper.java:631)
at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:604)
at com.graphhopper.http.DefaultModule.createGraphHopper(DefaultModule.java:56)
at com.graphhopper.http.DefaultModule.configure(DefaultModule.java:69)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.AbstractModule.install(AbstractModule.java:118)
at com.graphhopper.http.GHServer$1.configure(GHServer.java:114)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at com.graphhopper.http.GHServer.start(GHServer.java:62)
at com.graphhopper.http.GHServer.main(GHServer.java:48)

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 graphhopper.sh you’d do

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

karussell
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!
Bob
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