Offline navigation - GraphHopper - preparation

Started by Menion, July 16, 2014, 20:43:19

0 Members and 4 Guests are viewing this topic.

john_percy

Quote from: tommi on March 06, 2015, 19:47:31
Quote from: menion on March 06, 2015, 16:04:12
Yes and two more missing features ... one way roads and roundabouts. Anyway to be true I do not know if any of these issue is solved ...
Give us a new version and new data and we'll find out
I have just tested the latest version of GraphHopper on Emux's Atlas and it seems to know and respect roundabouts and one way streets.
Voluntary and Velocity themes - https://voluntary.nichesite.org
  •  

Tomáš Janoušek

Hello everyone,

as I was not very happy with the routes from MapQuest and YOURS and the other engines didn't have either instructions or a bicycle profile, I decided to give GraphHopper a try. Naturally I didn't want to use an old version of GraphHopper and OSM data, so I had to write a few lines of code myself. I ended up creating two things (in that order):


  • a command line converter from GraphHopper Directions API JSON written in Haskell (not very useful as you need to get those JSONs somewhere, e.g. using a Chrome dev console)
  • a JavaScript implementation of the same thing, usable as a bookmarklet (essentially a one click solution that turns a route planned on graphhopper website into a gpx importable into Locus)

Usage:

If no gpx is downloaded, there should be an error in the developer console.

I'm sorry if things don't work or if the usage is strange. This is my first javascript since almost forever. Nevertheless I hope this may be useful for someone else as well. :-)
  •  

Andrew Heard

Very interesting post Tomáš. Why did you choose GraphHopper instead of BRouter? For me offline BR with Locus has the advantage I can (with support from clever people) modify the selected fastbike.brf profile to suit local conditions (eg. cycling allowed on motorway, add more cost to gravel track) whereas with offline GH with Locus the rules & costs are not modifyable by an "ordinary" user, and there is no script customization possible. The script ability of BR has made its routing choices near to perfect.
LM4.26.2 GOLD user ID:c7d47597a
  •  

Tomáš Janoušek

Andrew, I didn't abandon BRouter completely. It stays as my engine of choice for offline route planning, although I haven't experimented with customizing the profiles yet. Anyway it's fine for planning medium range sport rides which I can memorize. However, on longer rides in unknown territory I'd much prefer to have good spoken navigation instructions and that simply isn't possible with BRouter. I know it's quite a limitation that I need to plan these routes online on graphhopper website, but for my intended usecase (long rides from A to B) it's okay.

But yeah, a customizable profile and offline routing with GraphHopper would be better, and I believe we'll get there in a few months/years. I just wanted to hack something together to have more options. Also, to be honest, I feel that the customizable profile might be a bit overrated, especially in our area where many roads/tracks are just guesses from low-res orthophoto maps that are years old and were never updates or modified afterwards (*). It's nice to have perfect routing, but it's not that useful if it's in an imaginary world. :-)

(*) I'd like to fix that but I have yet to figure out a way to do so. When I plan a sport ride I certainly don't want to stop every 500 meters to compare a map with reality and take notes. Carrying a GoPro in timelapse mode, uploading to Mapillary and fixing the map afterwards seems like a solution, but I'll need to make a habit out of it: the few times I tried it added a lot of overhead as well so I usually leave it at home and enjoy the ride instead. And I may need to get a few additional batteries. :-)
  •  

Andrew Heard

#79
Fascinating, thanks for the discussion. I didn't realize GH provided street names back to Locus. There are so many things that are only discovered the hard way because there isn't a comparison table. I gave up with GH because it chose a silly route along a gravel track of the same length as a quiet paved road right next to it. When I asked the GH developers they showed me where in the Java code to modify behavior, and agreed that bringing that logic out to a script would be nice, but no time soon. Hacking the BR profile for our local laws & my preferences was a great step forward.

Planning the routes online is a dream compared to offline. I wish it were easier.

I am finding the same comparing navigation and guiding modes - subtle differences that are not documented in just one easy to compare table. I've got a 1200km cycle sport ride in France in August, but the track planning was definitely not done by a routing engine. Every turn would have been physically planned & checked. I have a dyno on the front wheel, so batteries aren't a concern to me ;-)
LM4.26.2 GOLD user ID:c7d47597a
  •  

Bucky Kid

GH works better than MapQuest for me, however is there possibility for newer routing data (or way to create them from some online available data). I think uodate would be nice  :)
  •  

Menion

Uff new data, see first post. I've not tested it so hope it will work. And now excuse me, bed is calling ...
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

Bucky Kid

Awesome, thanks. Could we have a guide how to use the generator (I assume it serves for creating offline routing data from online source if I'm right)?
  •  

Menion

Yup, from OSM data. Description is in the link in first topic. Section "maps" contains few steps so use "generator.zip" from Google Drive for this task.

I still see there few major limitations
- for car - it is not simply possible to ignore highways
- generally it is not possible to route over more data files at once
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

john_percy

#84
Great. If anyone is interested I downloaded the British Isles routing data as described, as an osm.pbf file from http://download.geofabrik.de/ (it's a Special Region at the bottom of the Europe page) and generated GraphHopper files (actually using a function built in to Atlas but I'm sure it would work as menion describes) and now have offline routing in Locus across the whole of the British Isles. I'm happy.

Voluntary and Velocity themes - https://voluntary.nichesite.org
  •  

tommi

Hi Menion,
referring to your english post in the german part of the forum, precisely this one:
http://forum.locusmap.eu/index.php?topic=4661.msg37837#msg37837
I have problems with graphhopper data folder on external sd card.
I've placed all my vector maps at
/storage/extSdCard/LocusMassData/mapsVector
according http://www.locusmap.eu/locus-run-since-update-device-android-4-4-2-kitkat/#solutionC .

The vector maps are in sub folders for the continents. Locus is happy to use the vector maps from there.

In the same folder /storage/extSdCard/LocusMassData/mapsVector I have put the folder _germany.osm-gh
So it looks like:
/storage/extSdCard/LocusMassData/mapsVector/Europe/*.map
/storage/extSdCard/LocusMassData/mapsVector/_germany.osm-gh

The Graphhopper Addon doesn't find its data folder and complains I should place the data at /storage/emulated/0/Locus/mapsVector.
If I put the _germany.osm-gh to the recommended location in the Locus folder, GraphHopper Addon finds its data folder and I can use the router..
But due to free space limits I want to put all those bulk data to external storage.

As Balloni did, I deleted  the app data of GraphHopper addon. Next time I started the addon again it showed me the hint to put the data to internal storage as before.

Any idea?
Thanks,
Tommi
  •  

Menion

tommi, this is correct behavior.

Locus, better "add-on" search for it's data in defined ROOT directory for Locus vector maps. By default, it is in Locus/mapsVector. You may anyway define this root directory to your SD card - http://docs.locusmap.eu/doku.php?id=manual:user_guide:settings:misc - "default directories" settings.

This say to Locus, that Locus/mapsVector is no longer used and for all operations is used directory on SD card. So also themes, also POIs, also maps. Anyway, warning - if you download maps from Locus Store, this will ends on some bad error probably, because Locus Store won't be able to write downloaded data to this directory.

Another alternative, from my point of view best in case of vector maps, is to place this "mapsVector" directory on SD card into /android/data/menion.android.locus(.pro)/files/... directory. Here have Locus full read/write access!! - check solution B http://www.locusmap.eu/locus-run-since-update-device-android-4-4-2-kitkat/#solutionB . Just keep in mind to not un-install Locus otherwise this directory will be deleted!

Helped?
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

john_percy

@menion: I think @tommi needs clarification on where the GraphHopper data should be put.
I have a gh folder at the same level as the map, which works. However the reference page seems to suggest that the map should be in the folder with the GraphHopper data.
Voluntary and Velocity themes - https://voluntary.nichesite.org
  •  

Menion

hmm where you see that "map should be in the folder with the GraphHopper data"?

System is really simple. Directory Locus/mapsVector is container for all Locus vector (mapsForge) maps. And in same directory should be routing data for graphHopper. It is the place, were add-on search for them. No matter how deep (nested subfolders) they are, add-on just search for directories that ends with "-gh".
- Official help (ideas, questions, problems): help.locusmap.eu
- Advanced topics, sharing of knowledges: you're here!
- LM 4 Beta download, LM 4 Release download
  •  

john_percy

Quote from: menion on June 25, 2015, 07:18:58
hmm where you see that "map should be in the folder with the GraphHopper data"?

System is really simple. Directory Locus/mapsVector is container for all Locus vector (mapsForge) maps. And in same directory should be routing data for graphHopper. It is the place, were add-on search for them. No matter how deep (nested subfolders) they are, add-on just search for directories that ends with "-gh".
See the link "how to generate routing data" in your first post; then point 4: put berlin.map in the same folder as your routing data.
Voluntary and Velocity themes - https://voluntary.nichesite.org
  •