Skip to content
karussell edited this page Mar 15, 2013 · 48 revisions

Demo

Download GraphHopper Demo

Set-up

As starting point you can use the demo project which can be used from Eclipse or NetBeans via maven command line.

Before installation

$ git clone git://github.com/graphhopper/graphhopper.git graphhopper
$ # switch to stable branch
$ cd graphhopper; git checkout 0.1; ./run.sh your-area.osm
$ git clone git://github.com/graphhopper/graphhopper-android.git graphhopper-android
$ cd graphhopper-android; git checkout 0.1

And go to the Android SDK Manager and install 2.2 (API 8)

Maven Command line

  1. Go to graphhopper sources and make sure mvn -version prints at least 3.0.3
  2. Create the graphhopper artifact via mvn -DskipTests=true clean install. Optionally start the application from command line via mvn android:deploy android:run
  3. Download Maven SDK Deployer and execute mvn install -P 2.2 - it uses Android Maven Plugin under the hood where you need to set up ANDROID_HOME
  4. Install Mapsforge in your local repository via the provided script scripts/maven-install-mapsforge.sh
  5. Now go to the graphhopper-android project, build and start GraphHopper via mvn -DskipTests=true clean install android:deploy android:run

Eclipse

Import Sources as Android project. If you want to customize graphhopper itself do:

  1. Go to graphhopper sources
  2. Create the graphhopper jar via mvn -DskipTests=true clean install assembly:single
  3. Use the graphhopper-[version]-android.jar and copy it to the libs folder of graphhopper-android. Refresh and use it.

Maps

Now that you have a running android app you need to copy somehow the routing and maps data.

  1. Download the raw openstreetmap file - you'll need that only for the next step to create the routing data
  2. Execute run.sh (which lays in graphhopper). This creates the routing data
  3. Download a map e.g. berlin.map
  4. Copy berlin.map into the created berlin-gh folder
  5. Optional Compression Step: Bundle a graphhopper zip file via cd berlin-gh;zip -r berlin.ghz *
  6. Now copy the berlin-gh folder from step 4 (or the .ghz file from step 5) to android /sdcard/graphhopper/maps - e.g. use SSHDroid: scp -P 2222 berlin.ghz root@$URL:/sdcard/graphhopper/maps/

Limitations

  • For now OSMReader does not work on Android due to some javax.xml dependencies. But you can simply create the graphhopper folder on your desktop and copy them to the Android storage.

  • A memory bound a* algoritm is not yet implemented. Let me know if you need this!

Example

Routes for areas of up to 500km^2 are calculated in under 5s with the help of Contraction Hierarchies

simple routing

Clone this wiki locally