forked from graphhopper/graphhopper
-
Notifications
You must be signed in to change notification settings - Fork 1
Android
karussell edited this page Feb 12, 2013
·
48 revisions
As starting point you can use this example which can be used from Eclipse or NetBeans via maven command line.
Before installation 0. Go to the Android SDK Manager and install 2.2 (API 8)
Maven Command line
- Go to graphhopper sources and make sure
mvn -version
prints at least 3.0.3 - Create the graphhopper artifact via
mvn -DskipTests=true clean install
- 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 - Install Mapsforge in your local repository via the provided script
scripts/maven-install-mapsforge.sh
- 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:
- Go to graphhopper sources
- Create the graphhopper jar via
mvn -DskipTests=true clean install assembly:single
- 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.
- Download the raw openstreetmap file - you'll need that only for the next step to create the routing data
- Execute run.sh (which lays in graphhopper). This creates the routing data
- Download a map e.g. berlin.map
- Copy berlin.map into the created berlin-gh folder
- Optional: Bundle a graphhopper zip file via cd berlin-gh;zip -r berlin.ghz *
- Now copy the .ghz file or the -gh folder to android. E.g. use SSHDroid: scp -P 2222 berlin.ghz root@$URL:/sdcard/graphhopper/maps/
-
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!
Routes for areas of up to 500km^2 are calculated in under 5s