问题
I have been messing around for a while with osmdroid and osm bonus pack(amazing libs!), and have been pondering on the idea of offline routing and turn by turn navigation, now, I haven't tried anything yet, but something sounds very promising in throwing graphhopper in on the mix:
The official Wiki guide is as following:
- Download a raw map file(.osm, .osm.pbf, etc.).
- Run ./graphhopper.sh import map_file
Now, this is designed to work with MapsForge, and I haven't had the chance to check out the resulting .ghz file, containing the routing data for the map, BUT my question is this, could it be possible to use this routing data to build a PathOverlay object coming in OSM Bonus Pack to actually draw routes of some kind?
I wonder if someone already tried something of this sort and has something to say about it, any help appreciated.
回答1:
Using Mapsforge in osmdroid: holy grail, never-ending story...
You can have a look at this (long) thread: https://groups.google.com/forum/#!topic/osmdroid/gSieR9BF_z0
There is also this working experiment: http://www.salidasoftware.com/how-to-render-mapsforge-tiles-in-osmdroid/
Now, if you really NEED offline routing, your options are:
You leave osmdroid/OSMBonusPack and move to Graphhopper/Mapsforge, as suggested by Karussell => you will find docs on Graphhopper web site.
Or you can have a look at OsmAnd. This is an app, not a lib. It has its own vector-based maps format (and toolset) and provides offline display and offline routing.
Or you can try to reach the holy grail, and merge Mapsforge, osmdroid, Graphhopper, and OSMBonusPack...
回答2:
The holy grail is possible, you can use osmdroid with vector maps and yes, GraphHopper works on Android, but be ready for OOM on low-end devices - GraphHopper requires a lot of memory.
My sample project should be a good point to start.
来源:https://stackoverflow.com/questions/23021620/graphhopper-osmdroid-for-osmdroid-offline-routing