Looking for offline map app
This post is deleted!
I don't know exact details, but Puremaps seems to work in 'Mixed' mode without an internet connection; as long as you browse to download the maps ahead of time. I am not sure if navigation works offline though.
@TotalSonic Well, I took another look at uNav, and I think I may have succeeded. From uNav's offline instruction page (which frankly is too sparse), I did ultimately manage to download map tiles using the program downloadosmtiles. The link suggested "zoom=5:18", but a zoom of eighteen, I discovered, is nuts. So, after it was downloading for a while (like, for many hours), I stopped it, content with a zoom of 17 (which had finished downloading).
Anyway, searching locations works on it, and the maps look good (tiles are from OpenStreetMap). I don't know if GPS on the phone works okay or not, though (I'll have to test it outside).
 Well, I walked around outside, and it knew where I was going. So, that's very good. It's a shame that the directions function in offline mode doesn't work. But, in general, my main concern for having a mapping program is to be able to always know where I am. So, I'm very pleased with its performance. And it seems to be very good in finding locations that I search for.
When we get OSM Scout Server ported over to UT, Pure Maps will be able to use the map data from that server for offline operation. This includes search, navigation, and map matching, in addition to MapboxGL map tiles.
Plan is to do it soon, but I will depend on packagers. On my side, I will use the same GUI abstraction as we have for Pure Maps for UBPorts support. On the server side abstraction is ready, I have to just add and test UT platform code.
While we are waiting for PureMaps to provide offline functionality, here some instructions on how to get offline maps for uNav working using downloadosmtiles. I do post this here because I did encounter a few stones on the road to success.
- download downloadosmtiles from the left hand menu
- extract to a folder on your harddisc, i.e. Downloads/osmtiles
- run the script with
perl downloadosmtiles.pl --link='http://www.openstreetmap.org/?lat=49.5782&lon=11.0076&zoom=10&layers=B000FTF' --zoom=5:16 --destdir=somewhere/maps
- of course replace coordninates with your target coordinates, the area seems to depend on the zoom value after the coords
- replace the path for destdir with another one, default is the current working directory
- change zoom levels, levels above 16 do take quite some time to download, you can download 5 to 16 first, and only level 17 or above later if you really need it
- copy the map-files (foldernames = zoom level i.e. 5) onto your phone i.e. in a folder Documents/uNav_maps
[zip the map tiles and copy the zip file, that is much faster than copying thousands of files]
- in Terminal app run the following commands:
rsync -avp . ~/.local/share/navigator.costales/maps
[rsync is faster than cp and gives you progress information]
- open up uNav, goto settings, change Modus to offline maps
To specify a bounding box for the tiles do be downloaded the command in step 3 needs to look like this:
perl downloadosmtiles.pl --latitude=47.35371:49.93708 --longitude=7.38281:10.54687 --zoom=5:7 --destdir=somewhere/maps
Have fun! Don't get lost!
for lazy guys like me:
If you do this regularly, you may wish to create yourself a small shell script in your phones home folder called i.e. cpbash.sh. Then only open Terminal and run
bash cpmaps.sh. Put the following two lines into the script:
rsync -avp . ~/.local/share/navigator.costales/maps
Troubleshooting: (on ubuntu 18.04)
... Can't locate Geo/OSM/Tiles.pm in @INC ...
- open the file downloadosmtiles.pl in a editor
- before line 6 add the following line:
use lib '/Downloads/OSMtiles/Geo-OSM-Tiles-0.04/lib';, replace the path with your download location
... Can't locate Geo/OSM/Tiles.pm in @INC ...
install YAML.pm by running:
sudo apt-get install libyaml-perl
you may need to create the folder maps to be like this: ~/.local/share/navigator.costales/maps, then map data wants to be in there in a structure like this (see https://unav.me/offline/) :
Hi, Unav does support offline maps; in settings it tells you (via a link) https://unav.me/offline/ how to do this. I am a big fan of Foxtrot and Tango GPS; I copied my PC offline map cache to the right file. It all works on my Nexus 4. Happy travelling.
Last time I was considering maps, I used downloadosmtiles to get tiles for the City of Toronto. I'm going to be visiting a sister in Guelph over the holidays, so I thought I'd try to get a map of Guelph on my phone too.
I use Debian, and downloadosmtiles is a Debian package, so the command is a bit different from what @danfro wrote above. Anyway, for me the tricky part is figuring out the correct latitude and longitude for the command. I looked up Guelph on Open Street Maps, and found the following: https://www.openstreetmap.org/search?query=guelph#map=12/43.5345/-80.2393. So, I took the numbers from the URL, plugged them into the command, and hoped for the best. We'll see how it turns out.
I also wonder how combining these extra tiles with the tiles I had previously downloaded (for Toronto) will work out. I don't know if there will be a conflict or not. Anyway, the progress is as follows:
mark@debian:~/Templates/Nexus5/Maps/Guelph$ downloadosmtiles --link='http://www.openstreetmap.org/?lat=43.5345&lon=-80.2393&zoom=9&layers=B000FTF' --zoom=8:16 Schedule 6 (2 x 3) tiles for zoom level 8 for download ... Schedule 12 (3 x 4) tiles for zoom level 9 for download ... Schedule 30 (5 x 6) tiles for zoom level 10 for download ... Schedule 108 (9 x 12) tiles for zoom level 11 for download ... Schedule 368 (16 x 23) tiles for zoom level 12 for download ... Schedule 1408 (32 x 44) tiles for zoom level 13 for download ... Schedule 5481 (63 x 87) tiles for zoom level 14 for download ... Schedule 21625 (125 x 173) tiles for zoom level 15 for download ... Schedule 86250 (250 x 345) tiles for zoom level 16 for download ... Download 6 tiles for zoom level 8 ... Download 12 tiles for zoom level 9 ... Download 30 tiles for zoom level 10 ... Download 108 tiles for zoom level 11 ... Download 368 tiles for zoom level 12 ... Download 1408 tiles for zoom level 13 ... Download 5481 tiles for zoom level 14 ... Download 21625 tiles for zoom level 15 ...
It'll take a while for zoom level 16 to finish.
@99 I know about that link, but the wikipedia page for JTileDownloader states that it is blocked by the servers. And at least when I tried it I could not get it working. Thats why I posted instructions for another way to download files.
But if JTileDownloader works (again?) that would be nice!
@MarkG_108 You can go on OSM and right click a location. In the contex menu select "show address". Then in the menu on the left side also the coordinates are displayed.
@danfro I struggled to get it to work, but I did succeed a couple of months ago when I downloaded the tiles for Toronto. Then, I think I framed the command a bit different to box in Toronto and not download tiles of a lot of the surrounding areas. But I couldn't recall exactly how I did that. Anyway, thanks for the tip about the coordinates. That will make it much easier to box in the area of interest. I'll test it out now on a small town in northern Ontario called Orillia:
mark@debian:~/Templates/Nexus5/Maps/Orillia$ downloadosmtiles --lat=44.5575:44.6464 --lon=-79.4827:-79.3642 --zoom=6:14 Schedule 1 (1 x 1) tiles for zoom level 6 for download ... Schedule 1 (1 x 1) tiles for zoom level 7 for download ... Schedule 1 (1 x 1) tiles for zoom level 8 for download ... Schedule 4 (2 x 2) tiles for zoom level 9 for download ... Schedule 4 (2 x 2) tiles for zoom level 10 for download ... Schedule 4 (2 x 2) tiles for zoom level 11 for download ... Schedule 6 (3 x 2) tiles for zoom level 12 for download ... Schedule 16 (4 x 4) tiles for zoom level 13 for download ... Schedule 49 (7 x 7) tiles for zoom level 14 for download ... Download 1 tiles for zoom level 6 ... Download 1 tiles for zoom level 7 ... Download 1 tiles for zoom level 8 ... Download 4 tiles for zoom level 9 ... Download 4 tiles for zoom level 10 ... Download 4 tiles for zoom level 11 ... Download 6 tiles for zoom level 12 ... Download 16 tiles for zoom level 13 ... Download 49 tiles for zoom level 14 ... mark@debian:~/Templates/Nexus5/Maps/Orillia$ downloadosmtiles --lat=44.5575:44.6464 --lon=-79.4827:-79.3642 --zoom=15:16 Schedule 156 (12 x 13) tiles for zoom level 15 for download ... Schedule 552 (23 x 24) tiles for zoom level 16 for download ... Download 156 tiles for zoom level 15 ... Download 552 tiles for zoom level 16 ... mark@debian:~/Templates/Nexus5/Maps/Orillia$
That worked. I discovered it works when it's the coordinates from the lower south-west corner as the first numbers, followed by the coordinates from the upper north-east corner as the second numbers. Boxing in an area is helpful in that it's only cities or towns where higher zoom levels are useful, rather than rural areas. So, good to be able to isolate areas to not waste time and bandwidth. Your tip about right-clicking to get the coordinates was very helpful (I recall messing around a lot trying to figure out coordinates when I did this previously).
As I mentioned, I previously had downloaded tiles for Toronto. So, now I've done them for Guelph, and there's a bit of overlap. My worry was that there might be a different indexing system used by the two tile downloads, meaning that there would be a conflict if I tried to merge the tiles of the two downloads together. But, it appears that the indexing system is the same, which I see when I look at the overlapping areas (the tiles and how they're numbered are identical). So, I can just add the Guelph tiles (the recent download) to the former download (the Toronto tiles) for a more complete map. To unify everything I'll download the low zoom tiles for all of Ontario. If there's other cities I want in the future (in higher zoom) I can just add them later.
Okay, I've now combined the Guelph and Toronto (along with the Orillia) tiles. I realized that manually copying these thousands of files using a gui file manager would take years. So, I searched and found a good command line answer here: https://unix.stackexchange.com/questions/83593/copy-specific-file-type-keeping-the-folder-structure
The specific command that worked was the following:
find -name "*.png" | xargs cp --parents -t /target
I first isolated a couple of directories and did a test run, which seemed okay. The main combining of the Guelph and Toronto tiles was rather frightening (it took a while) but I believe it worked okay.
mark@debian:~/Templates/Nexus5/Maps/Orillia/test$ ls 14 15 mark@debian:~/Templates/Nexus5/Maps/Orillia/test$ find -name "*.png" | xargs cp --parents -t /home/mark/Templates/Nexus5/Maps/maps/testTO mark@debian:~/Templates/Nexus5/Maps/Orillia/test$ cd .. mark@debian:~/.local/share/Trash/files$ cd mark@debian:~$ cd Templates/Nexus5/Maps/Orillia mark@debian:~/Templates/Nexus5/Maps/Orillia$ ls 10 11 12 13 14 15 16 6 7 8 9 mark@debian:~/Templates/Nexus5/Maps/Orillia$ find -name "*.png" | xargs cp --parents -t /home/mark/Templates/Nexus5/Maps/maps/ mark@debian:~/Templates/Nexus5/Maps/Orillia$ cd .. mark@debian:~/Templates/Nexus5/Maps$ cd Guelph mark@debian:~/Templates/Nexus5/Maps/Guelph$ find -name "*.png" | xargs cp --parents -t /home/mark/Templates/Nexus5/Maps/maps/ mark@debian:~/Templates/Nexus5/Maps/Guelph$
I'll now download Ontario overall up to zoom 10, combine that, and then upload it to the phone.
Well, I uploaded it to my phone, which took a LONG time. It was a gig of data, so about the same size as uploading a large video, but it took much longer, given that it's thousands of little files (tiles in the maps folder). Anyway, it's there, and it works. Here's a couple of photos of how Guelph appeared before (when I just had Toronto mapped -- Guelph is in uncharted territory) and how it appears now:
@MarkG_108 Just in case you missed it, as I wrote under no. 4, zip the tiles before copying them onto your phone. That does work MUCH faster than transferring all files individually.
@danfro Thanks. Very good idea.
I've run into a new issue. Seems I can't search maps unless I have my data turned on. By comparison, using OsmAnd~ didn't require having data or WiFi on to search locations on maps. It was "offline", as I initially assumed this set up to be.
Another more manual workaround: ...could take some map screenshots and take down directions in notes, or make a pdf of maps and just use a pdf reader on the phone. I mention this because it has worked for my use cases before and I've done workarounds like this that "just work" (for me). If your'e going on a longer distance trip and really need more detailed maps, an offline maps on a laptop and particular screenshots as you go might also be a workaround.
Dunno if any other apps work in Libertine containers or Anbox.
Yes, screen shots and directions in notes would just work. Or asking people for directions often works. Buying a map at a gas station is useful too.
I find that both Anbox and Libertine can only do the most basic things. It's like how WINE was on Linux. I haven't found any real use for either of these containers yet.
I guess what I'm hoping is to get something on Ubuntu Touch that works almost as well for me as OsmAnd~, backed by UnifiedNlp (no GAPPS), on LineageOS 13, worked for me. I thought I had it with uNav, but I now don't think so.
There's a far more detailed account of setting up tiles in uNav here: https://forums.ubports.com/topic/2653/how-to-offline-unav-maps/13
I found it rather confusing. It seems to address how to set it up so that an area could be updated without having to download everything again.
Hmm, actually, in looking at the uNav site, I see the following: "Remember, this will allow offline maps, but not offline routing." I assume that also includes searches for locations. That's a drawback. Though, with GPS, I'll at least know where I'm at. And perhaps not much data is used via looking for addresses within the map tiles I now have on my phone. Still, not being able to search for locations unless I'm online is a huge drawback.  I emailed Matthias to ask about this.
@MarkG_108 As mentioned above, when OSM Scout Server (https://rinigus.github.io/osmscout-server/en/) will get ported to Ubuntu Touch, that one will provide offline search, map tiles (vector and raster), as well as route calculation. As a result, map clients, such as Pure Maps, can work in fully offline mode. Should be easy to expand to uNav as well - uNav would have to just use the documented HTTP API to use it. Such solution works perfectly on Sailfish for years now, with Pure Maps, modRana, and Laufhelden accessing the same offline server for data.
To my understanding, porting has been stuck on permissions system used by Ubuntu Touch. Communication between OSM Scout Server and Pure Maps (or other clients) is done via HTTP (raster tiles, search, routing) at localhost port. That probably requires some kind of unrestricted app - not sure what it means. In addition, the persons who helped me with Pure Maps are probably just busy right now. So, while I am happy to help on my side by adjusting code and adapting the abstraction layers that I used for Pure Maps, I need someone to work on UBPorts side by writing packaging scripts and testing on device.
As for uNav offline, it sounds its essentially map tiles cache used by that app. You cache only bitmaps, without databases that can be searched or used for routing.
AppLee last edited by
@rinigus Hi, do you know who's working on UT port of OSM Scout Server ?
I might give it a try if no one is active on this.
Do you know if someone tried to make it work already or if the HTTP connection has been tested unsuccessfully ?