GraphHopper - Offline Routing for MapsForge

4,414 views
Skip to first unread message

Karussell

unread,
Nov 9, 2012, 7:54:24 AM11/9/12
to mapsfo...@googlegroups.com
Hey all,

I've created an Open Source Java routing project at GraphHopper.com which is alpha.

It works on Android too and has a rather simple ('click to route') mapsforge demo:

You need to put the files under "ExternalStorage"/graphhopper/maps/ before starting the app! 

If you want to create routing on your own areas then read through create-graph.sh. It uses a snapshot of mapsforge 0.3.1 and executing on larger areas (>200km^2) works but is currently not optimized on Android (e.g. no heuristics applied) and could take several seconds.

Would welcome suggestions & contributions like a downloader or file navigator etc!

Regards,
Peter.

Ludwig

unread,
Nov 10, 2012, 5:11:39 AM11/10/12
to mapsfo...@googlegroups.com
Very impressive, for everything that I tried much faster than I would have imagined is possible on a phone. It seemed to work even nicely on the borders of the map area (routing inside without giving error messages).

Congratulations, well done.

Ludwig

adventure...@gmail.com

unread,
Jan 1, 2013, 4:05:21 AM1/1/13
to mapsfo...@googlegroups.com
I tried the desktop version - it's certainly fast there - good job!

The routing database seems big for mobile use - e.g. a compiled mapsforge map file for map display for my local area is 700kB - the corresponding routing file, unless I've made some big mistake, was 30MB.  Is there some tuning option to trade off routing database size vs. runtime speed whilst still being able to control runtime heap memory limits (for mobile)? 

emux

unread,
Jan 1, 2013, 10:28:56 AM1/1/13
to mapsfo...@googlegroups.com
Hi,

The https://github.com/graphhopper/graphhopper-android/downloads is currently empty. There are no map or gh files/folders to test.
Also the create-graph.sh in graphhopper-android (is this the only way to create route files?) does not work out of the box as it seems to need name / classpath modifications in it.

Thanks.

Gheorghe Chirica

unread,
Jan 2, 2013, 6:36:20 PM1/2/13
to mapsfo...@googlegroups.com
Hi!

Somehow I can't make android version https://github.com/graphhopper/graphhopper-android to work.  

I'm running ./create-graph.sh unterfranken.osm  and I get the following Exception:

## existing jar found ../graphhopper/target/graphhopper-0.1-SNAPSHOT-jar-with-dependencies.jar
## now creating graph unterfranken-gh from unterfranken.osm,  java opts=-XX:PermSize=20m -XX:MaxPermSize=20m -Xmx1200m -Xms1200m
## HINT: put the osm on an external usb drive which should speed up import time
2013-01-03 01:30:53,567 [main] INFO  com.graphhopper.reader.OSMReader - using GraphStorage|RAMDirectory|2, memory:totalMB:1150, usedMB:6
Exception in thread "main" java.lang.IllegalArgumentException: Graph not found and no OSM xml provided.
at com.graphhopper.reader.OSMReader.osm2Graph(OSMReader.java:159)
at com.graphhopper.reader.OSMReader.osm2Graph(OSMReader.java:142)
at com.graphhopper.reader.OSMReader.main(OSMReader.java:68)

Will be good to have it working out of box(as emux mentioned).
 
p.s Desktop version is working great!

Karussell

unread,
Feb 12, 2013, 10:32:21 AM2/12/13
to mapsfo...@googlegroups.com
Hey all,

better late than never ;)

> Very impressive, for everything that I tried much faster than I would have imagined is possible on a phone

Thanks! Now it is 5 times faster again, which is especially useful for large areas! 
E.g. for a 500km^2 area a 500km route is calculated in 5s, which is the exact (!), fastest path for a car (at the moment without turnrestrictions).
Heuristics are not used (yet).


> Will be good to have it working out of box(as emux mentioned).

GitHub disabled the download section so I couldn't update the apk with the latest version, which is faster and smaller. So I removed it.
But I prepared a new one here:

If you just want to try it out you do not need to install a map - just choose one in the app and it will downloads & unzips it for you.


> Also the create-graph.sh in graphhopper-android does not work out of the box

This is removed in the latest version, as the script run.sh of graphhopper itself does the work (the file format for the android version is now identical)
See the 'maps' section:


> The routing database seems big for mobile use - e.g. a compiled mapsforge map file for map display for my local area is 700kB - 
> the corresponding routing file, unless I've made some big mistake, was 30MB

How did you created your local area? Also check out the new version. The size of the routing data is similar to the map itself
(sometimes 40% smaller, like for big cities ala berlin or around 20% larger for bigger less "tag-intensive" areas).

Regards,
Peter.

emux

unread,
Feb 12, 2013, 1:18:36 PM2/12/13
to mapsfo...@googlegroups.com
I tried the apk with the available ghz files. Very good work on that, congratulations!

But I want to build some graphs based on other osm files and find the whole process very unfriendly...
Why you made such a complex bash file with maven for build the jar file?!
It would be more convenient to just provide a simple jar download with its dependencies (like mapsforge team) besides the apk in order for the users to easy test the graph creation.

Karussell

unread,
Feb 12, 2013, 1:29:05 PM2/12/13
to mapsfo...@googlegroups.com
> I tried the apk with the available ghz files. Very good work on that, congratulations!

Thanks! Nice to hear this worked for you!

Yes, it is a bit unfriendly. But at the moment I want to focus on development and on developers instead of users creating their customized maps.
There are still too many ToDos before shifting the focus to the user ... e.g. in the last month I changed the file format at least twice times.

If you think you would provide and maintain such a maps creator, please feel free to contribute ... as well as for the raw Android app :) !

Regards,
Peter.

emux

unread,
Feb 12, 2013, 2:43:36 PM2/12/13
to mapsfo...@googlegroups.com
Well don't misunderstood me I just want to be helpful. Actually I am a developer.

Anyway I ran successfully the run.sh building the jars and producing graphs for various osm - including the default unterfranken-gh.
But when I put the builded files at Android device after the toast message of 'loading graph' I get another toast message informing that 'Cannot load the graph - it wasn't create via com.graphhopper.storage.LevelGraphStorage'.
I see this happens at hash check at line 890 of GraphStorage.
However the downloaded berlin.ghz plays just fine. Any hint?

Again it is a fine implementation of offline routing, specially for mobile devices considering their hardware limitations. Well done!

Karussell

unread,
Feb 12, 2013, 3:05:05 PM2/12/13
to mapsfo...@googlegroups.com
Ah, ok :)
Thanks for trying this out even in this early stage :)


> But when I put the builded files at Android device

Either use osmreader.chShortcuts=fastest in the config.properties before creating the graph files or change the android source and uncomment the line with hopp.contractionHierarchies(true);

This "chShortcuts" produces an 'enhanced', bigger graph which is a lot faster - often required not only for Android but also for the server-side.

Regards,
Peter.

Karussell

unread,
Feb 12, 2013, 3:06:11 PM2/12/13
to mapsfo...@googlegroups.com
ups, I meant "or remove the line with hopp.contractionHierarchies(true);"

Then you can use "normal" graphs on Android too

emux

unread,
Feb 13, 2013, 3:06:19 AM2/13/13
to mapsfo...@googlegroups.com
I tried the graph rebuild with your recommended change and all works well now.
Thanks!

duyduy

unread,
Apr 3, 2013, 12:27:46 AM4/3/13
to mapsfo...@googlegroups.com
Hi there,
I'm very interested in your project (special in routing).
I was compiled it and it's fine. So, I think in this demo, it just work with a little of places (such us Berlin, Newyork)
I come from Vietnam and I want to make it work routing offline in Vietnam.
So I was followed these step to create vietnam.ghz, but I when I run 'Run.sh' file in graphhopper, it said: 'line 1: mvn: command not found'
And I don't know where is the path that folder vietnam-gh created (if run.sh is ok).
Can you explain and give me more instructions about how to create *ghz file?
Thank!

Duy.

Vào 19:54:24 UTC+7 Thứ sáu, ngày 09 tháng mười một năm 2012, Karussell đã viết:

Karussell

unread,
Apr 3, 2013, 3:27:00 AM4/3/13
to mapsfo...@googlegroups.com
Hi Duy,

we should switch to the graphhopper mailing list for that to avoid spamming mapsforge users :)

The vietnam-gh folder should be created in the same folder where the osm file resides.
Also if 'mvn' is not found then an application called 'maven' should be automatically downloaded to build the graphhopper jar.

Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Krishna Swaroop

unread,
Mar 25, 2014, 6:39:40 AM3/25/14
to mapsfo...@googlegroups.com
Hi,

I downloaded routing data for India map, But it's not working.
Can you help me to resolve the issues related to routing data of India?
I used routing data for Berlin map i.e europe_germany_berlin-gh is working fine.


regards,
Krishna

Karussell

unread,
Mar 25, 2014, 10:40:13 AM3/25/14
to mapsfo...@googlegroups.com
Hey Krishna,

maybe that is more appropriate on our mailing list :)

https://lists.openstreetmap.org/listinfo/graphhopper

Feel free to subscribe there. Then please include the exception you get or the logs with all eceptions.

And describe which data you use (e.g. downloaded from server? 0.3 or 0.2? created your own? then which config you used etc). Additionally the GraphHopper version is necessary to help you more.

Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "mapsforge-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapsforge-de...@googlegroups.com.
Message has been deleted

Krishna Swaroop

unread,
Mar 26, 2014, 5:19:26 AM3/26/14
to mapsfo...@googlegroups.com

Hi Peter,

I generated routing data of India using graphhoper.sh file.
First, i downloaded india-latest.osm.pbf file,
Then executed        ./graphhopper.sh import india-latest.osm.pbf

After the complete execution of above command, i got routing data of India.
Then i made a directory india-gh in the sdcard, which contains all the six files as node, edge, name etc.

I am using same steps for india routing data as europe_germany_berlin routing data,

and it's not working for India, but working for europe_germany_berlin.


Note: I am using graphhopper 1.0 library.

Regards,
Krishna

Ludwig

unread,
Mar 26, 2014, 5:21:16 AM3/26/14
to mapsfo...@googlegroups.com

Can you move this discussion to the graphhopper list as previously suggested?

jasmeet sahni

unread,
Jun 30, 2017, 11:46:27 AM6/30/17
to mapsforge-dev
Hi
I am new to this field can u please tell me complete starting steps to run this graphhopper app for routing data of india map

Thanks
Jasmeet

Emux

unread,
Jun 30, 2017, 12:10:40 PM6/30/17
to mapsfo...@googlegroups.com, jasmeet sahni
We maintain an Android sample in GraphHopper repository demonstrating how Mapsforge or VTM can work together with GraphHopper for a complete offline map + routing experience.

See: https://github.com/graphhopper/graphhopper/tree/master/android

--
Emux

Emux

unread,
Jun 30, 2017, 12:14:50 PM6/30/17
to mapsfo...@googlegroups.com, 24ja...@gmail.com
BTW GraphHopper routing related questions better asked in its forum.

Here we can help more with the map libraries.

--
Emux

pranjalesh ghansiyal

unread,
Jun 5, 2018, 1:55:42 AM6/5/18
to mapsforge-dev
Could you please post an updated link for the offline map routing example in android.

Emux

unread,
Jun 5, 2018, 2:54:09 AM6/5/18
to mapsfo...@googlegroups.com
If you mean the GraphHopper Android samples they are:

- Using VTM OpenGL vector map library: https://github.com/graphhopper/graphhopper/tree/master/android

- Using Mapsforge vector map library: https://github.com/graphhopper/graphhopper/tree/0.8/android

--
Emux

pranjalesh ghansiyal

unread,
Jun 5, 2018, 3:42:24 AM6/5/18
to mapsforge-dev
Is there any working exaple?.Because these examples don't work

Emux

unread,
Jun 5, 2018, 3:43:56 AM6/5/18
to mapsfo...@googlegroups.com
They work fine last time we checked them.

If you need additional help for GraphHopper can ask in its forum.

--
Emux
Reply all
Reply to author
Forward
0 new messages