Download the raw openstreetmap file - you’ll need that for the next step to create the routing data
Execute ./graphhopper.sh import . This creates the routing data
Download a map e.g. berlin.map
Copy berlin.map into the created berlin-gh folder
I use :
GraphHopper tmpHopp = new GraphHopper().forMobile();
tmpHopp.load(“/mnt/sdcard/osmdroid/map.osm”);
But it was wrong.
I don’t understand it.If someone could tell me how to do step by step carefully,thanks a lot~
in my understanding GraphHopper alone is not sufficient for this offline planning. The combination of Cruiser and GraphHopper seems promising in this respect (no pointer at hand presently, please dig yourself for that), but I did not get those two to cooperate when tried that some months ago. Even though I would love to have such a feature myself I stayed with online planning due to lack of necessity and the omnipresent availability of an internet connection since then.
what does “currentArea” means?Does it can be named freely? And why I should plus “-gh”?
Today I saw your answer that “Routing via Java API”.So I want to get the data from osm file “.osm” without using mapforge.
I follow :
GraphHopper hopper = new GraphHopperOSM().forServer();
hopper.setOSMFile(osmFile);
hopper.setGraphHopperLocation(graphFolder);
hopper.setEncodingManager(new EncodingManager(“car”));
is OK .
BUT when I goes to :
hopper.importOrLoad();
there is an error:
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: java.lang.VerifyError: com/graphhopper/reader/OSMInputFile
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.graphhopper.reader.OSMReader.preProcess(OSMReader.java:168)
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.graphhopper.reader.OSMReader.readGraph(OSMReader.java:148)
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.graphhopper.GraphHopper.importData(GraphHopper.java:759)
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.graphhopper.GraphHopper.process(GraphHopper.java:725)
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.graphhopper.GraphHopper.importOrLoad(GraphHopper.java:698)
10-17 14:28:31.861 32197-774/com.example.administrator.myapplication E/AndroidRuntime: at com.example.administrator.myapplication.MainActivity$6.run(MainActivity.java:628)
osm & pbf files are containers of OpenStreetMap data.
To use them with Mapsforge you need to build a .map file (we provide maps here).
To use them with GraphHopper you need to build a graph (folder).
Performing builds on less powerful mobile devices can be difficult, you can do it on desktop and transfer the result.
Regarding Android sample, it downloads / unzips a selected area (containing a Mapsforge map and a GraphHopper graph) and then loads them.
I suggest to invest time and study its code, it shows many things for how to use GraphHopper API.
Run the Android sample, download with it an area and then check in the device storage the downloaded files to understand the structure.
Mapsforge and GraphHopper are two separate libraries, which load their data in different ways (Mapsforge here and GraphHopper here).
And again, don’t try building graphs on the mobile with importOrLoad (as you’ll need many more dependencies), do it on desktop with the recommended tools and transfer the graph afterwards.
Thank you very much!
I follow your suggestion and now I can run the sample berlin.map in my project.
And now I have another question,the map of China is too large(700M+) , I just need one province map,but I can’t find the file I need(just has one file of the whole China but not province or city).
Can I create map file by myself that I can get a smaller file?
Hello,I want to download the whole china.map from used graphhopper.
but the example app has not the China map.(only berlin , bayern,hamburg,sachsen,england,new-york)
Where I can download the map?Could you please give me some suggestions or a link?
In the server. I can only download the .map file.
But when I want to use offline navigation in graphhopper , I can not load the .map file without the edges file , how can I create my own edges file?