Saturday, January 10, 2015

PCT Offline Maps

Before hiking the PCT, I got hold of a very nice and comfortable file containing all the maps along the PCT. I got it from a friend, and I don't know how he got it, but it was very helpful indeed, especially when I used it along with BackCountry Navigator and the GPX files from Halfmile's site.
The past week, I've been fiddling around with creating a similar file myself, so I can freely post it over here, and distribute it to anyone who might want it. This post might get a bit too technical, so if you are here is just for the file,

It's in here (637Mb)

(Download on your home computer, or via Wi-Fi) Here's how to use the file as a map source in BackCountry Navigator:
  1. Copy it into your Android phone, under the bcnav\atlases folder (not sure exactly on how to do it on iPhone, but I assume it can be done).
  2. Inside BackCountry Navigator, tap on the "Layers" icon at the top
  3. Tap on "More Map Sources..."
  4. Tap on "Use Mobile Atlas" and select the file.
You will now have good quality topographical maps all along the trail, from Mexico to Canada. All you have to do now, is import the GPX files from Halfmile's site, and see the trail, side trails and waypoints, directly on the map.

And now, to the technical bits -
At first, I looked around the internet for the source of the file I originally had. I quickly found OpenStreetMap and OpenCycleMap as available map tile resources (though they do not freely allow bulk download of tiles). The OpenCycleMap project does show elevation lines, and would be appropriate for navigation while hiking.
I needed to go over the whole trail (a collection of lat/long coordinates), and for each such coordinate, download the appropriate map tiles, on different zoom levels (zoom level 0 is the entire world. zoom level 15 is a very well detailed map of about 4.7 meters per pixel, or 5.2 yards per pixel). Since the trail is continuous, many coordinates will appear on the same tile, so I'll only have to download tiles I haven't downloaded before.
Searching some more on the internet, I found the excellent free application Mobile Atlas Creator (MOBAC), which is doing exactly what I was looking for - it can take in data from GPX files (but not Google Earth KML/KMZ), select a map source, and pick all the needed tiles to download from the source. Then, it can create an Atlas, for different navigation applications. It already has a setting for BackCountry Navigator sqlite format, which was just what I was looking for. But if anybody here needs the offline file for a different mapping application, I will gladly help with creating it as well.
I had one major problem with using MOBAC - it did not contain the tile server source I was looking for.
Searching around some more, I ran into CalTopo, another nice site which allows different tiling servers to be displayed inside the browser. I finally found the source I was looking for, while looking around in their different options. It was ArcGIS USA Topo Maps. Success!
That was the bit where I started writing my own code, and putting up a simple application that reads a KML/KMZ file, calculates all the tiles it needs to download, and downloads it all from a selected map source. I had fun writing this app, and I think I will still improve upon it. But two days ago I realized I can just add this map source to use in MOBAC, and it deal with the entire downloading and packaging the result for me.
So yesterday and today I did just that. I let MOBAC do the heavy lifting. Another annoying thing in MOBAC is that it only lets you select tiles along a single track every time, so I downloaded the code, and changed it a bit to allow adding multiple tracks at the same time. It made making the Atlas much easier.
I kept getting a huge Atlas as a result, though. My original file was ~500Mb, and I kept getting files that were more around 4000Mb. That's quite a big difference. I kept fighting with it today, until I finally realized that MOBAC was downloading the tiles as JPG files from the tile server, and then converts them into PNG files, which increases their size (And not their quality). After realizing that, I've finally been able to create this file here, for the enjoyment of every future PCT hiker!
I will make similar files for other trails as well (AT, CDT, JMT, for start. And also the INT and some trails in Europe, but with different map sources). I will also gladly help anyone needing those files to be in different output format, for other mobile navigation apps. Don't hesitate to ask!