October 16, 2017

Setting up the maps on SD card for Atopo

I decided to arrange the map files for Atopo in a different way that they are found on the TOPO! disks, as described here. Here is a quick overview. On the SD card I create a directory named "topo". Atopo expects this, and will crash if you try to run it without this directory existing. I should test for this and provide an informative message, and will try to do so someday.

Also note that there seems to be no definite standard name for the SD card device. Atopo tries a number of likely suspects, such as "extSdCard" and such, but if your device has something new and clever it will have to be added to the list in Atopo.

The topo directory contains two files and 3 directories. The files are:

us1map1.tpq (2.39 M)
us1map2.tpq (33.7 M)
So we have two files for levels 1 and 2 that cover the entire united states, along with the three directories that provide levels 3, 4, and 5.

On my phone, I have all the maps for California, Arizona, Nevada, Utah, Colorado, and New Mexico. So the "l" directories have:

l3 -- 1249 files
l4 -- 414 files
l5 -- 12023 files

A few maps to get started with

The "tarball" android_base.tar.gz contains the entire United States for levels 1, 2 and 3. It includes the us1map1.tpq and us1map2.tpq files. This is fairly big (230M). The way to use it is as follows. Put your sdcard into a reader and get it mounted somehow (this differs on each system, so I won't try to give details). Let's suppose somehow you get it mounted as /media/sdcard. And let us assume that you have the "tarball" in your home directory, then do this:
cd /media/sdcard
mkdir topo
cd topo
tar xzvf /home/you/android_base.tar.gz
I also include a "zip" file in case it is impossible to use tar. It is intended to be used the same way and to be run inside of the topo directory on the SD card.

The files us1map1.tpq and us1map2.tpq are contained within the tar or zip files, so there is no need to download them if you download the bundles.

My ruby script

I use the following script to copy all of my maps to the SD card. This script is written in ruby, but is pretty short (182 lines), so it wouldn't be that hard to translate it to perl or python. But if you are on a linux system, make it easy on yourself and just install ruby and use this script with minor modifications.

More besides

At one point I had an SD card in hand with all my maps and made an image of it (using dd) so I could make copies. I keep this image around as atopo.img and it is 32G in size (with only about 24G of maps on it). When need arises, this disk image can be mounted via:
mkdir /mnt/maps
fdisk -l atopo.img
mount -o ro,loop,offset=4194304 atopo.img /mnt/maps
The fdisk command will show the offset to the first partition, which in this case is 8192, multiply this by 512 to get a byte offset of 4194304.
Feedback? Questions? Drop me a line!

Atopo / tom@mmto.org