Looking for offline map app



  • 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:

    screenshot20191223_145403107.png

    guelph.jpg 😵



  • @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.



  • Screenshots/PDF/Laptop+ScreenShots

    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.



  • @mirroronthewall,
    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. [edit] 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.



  • @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 ?



  • We were in touch with @jonnius on it, as he was leading on UBPorts side the port of Pure Maps. He tested socket(AF_INET, SOCK_STREAM) in confined app and it failed. On unconfined(?) it should work, as far as I understand.

    OSM Scout Server currently has 3 GUI variants - Sailfish Silica, Kirigami, and QtControls. I suggest to start with QtControls and later I will adapt Ubuntu Touch native look as soon as other issues are resolved.

    Server can be used with and without GUI (there is a command line switch for it). On Sailfish, GUI is used for downloading, updating, and removing maps; in addition for debugging. Normal operation is invisible via systemd socket activation. As you don't have systemd nor socket activation, we will start with just running it in GUI and serving maps on the background. So, users will have to start 2 apps to use offline maps. At least in the start, we can think about polishing later.

    The application is available as Flatpak at Flathub. So, you could already test it against Pure Maps running on the same PC (also as Flatpak).

    But yeah, get in touch with jonnius (Jonny on matrix) and discuss how to proceed.



  • @rinigus Thanks, I'll get in touch with him.
    This will be a great improvement for my personal use while traveling.



  • @AppLee Personal reasons are exactly why it was written 🙂


Log in to reply