Maps on a Stick Documentation

« Maps on a Stick Application

Getting Started

Setting up New Tiles

Maps on a Stick is made so that it can work with any map tiles that the OpenLayers Library can handle. To start off with, there are two sample tilesets for free consumption (and freely licensed) online.

Tilesets become much larger with higher zoom levels, so it will be much faster to start off running with the smaller tileset for testing purposes.

Tools are included on Mac OSX and Linux to decompress these files; on Windows, we recommend 7-Zip to do the unpacking. Once the files are unpacked, there will be a directory called world-dark. Move this directory into the mapsona folder, under the path tiles/1.0.0. The resulting path should be tiles/1.0.0/world-dark, and will contain numerical directories leading down to numerically-named png files.

The world-dark layer is included by default in the Maps on a Stick code, so you should be able to head over to the Maps on a Stick Application and see a beautiful indigo-colored world.

Using KML

Maps on a Stick can handle KML layers like you would use in Google Earth, and has two layers included by default: Earthquake Activity (December 2009, USGS source), and World Cities.

You can include each of these KML layers in a map by first clicking Choose File in the left-hand column. Select the KML file you want to use (in the directory kml), and then click Add to Map. The map will become populated with points indicating earthquakes or cities.

For unstyled KML, like the cities example, you can trigger different layer styles by clicking the colored square to the right of the layer name.

Customizing Maps on a Stick

Adding New KML

You can easily add new KML layers by dropping the KML files into the kml directory, and then adding them with the process under Using KML.

Creating new KML

The easiest way to create new KML files without touching a text editor or knowing any code is to use Google Earth. There is a tutorial in the documentation which describes how to create new placemarks and save them as a KML file.. Note that you will need to select KML, not KMZ as the file format.

Caveats

  • Some KML files are not actually self-contained, but include external, online elements like icons or references to extra online KML files.
  • Maps on a Stick does not currently support KMZ files - files with a .kmz extension which are essentially zipped KML. These can be supported by unzipping the files and then adding the contained KML.
  • For security reasons, KML files much currently be placed in the kml directory and cannot be included from external websites or other directories.

Adding New Tiles

Maps on a Stick fully supports adding new TMS layers. Online layers can be added by adding their map definitions to resources/layers.js, and new offline tilesets can be placed in tiles/1.0.0 and added to the same file by mimicking the existing layer definition. More details can be found in the actual source file.

Troubleshooting

Maps on a Stick has been tested in Firefox 3.5, Safari 4, and IE7. Currently Google Chrome does not support opening local files, so Maps on a Stick is not supported in Chrome.

For other problems, please post on the issue queue or email me.

ADVANCED: Loading Tiles & Code onto USB Drives

Flash drives are fast for many things - flash memory, especially when it's used in SSDs, has gotten a good reputation for being fast. However, flash, like many types of storage, has some problems dealing with lots of small files, so it's impractical to simply copy map tilesets from your computer to a USB drive. We're working on a better solution which consists of making an disk image, like an ISO, of the data you want to put on a drive, and then writing that image, complete with a filesystem, to the drive.

Requirements

  • This process will require familiarity with some low-level POSIX utilities, especially dd. This is not a guide you can run through by copying commands - it will require, at the very least, careful editing of the sample commands.
  • This is written for Apple Macintosh computers. POSIX equivalents to Mac helper applications like hdiutil certainly exist and a guide for doing this with Linux, etc., is certainly possible.

Create an Image from Folder

sudo hdiutil create -verbose -fs MS-DOS -volname "Maps on a Stick" -fsargs "-F 32 -c 16" -srcfolder your_map_application your_map_application.dmg

This command creates an Apple Disk Image from a folder on your computer. Notably, the image will have a FAT32 filesystem - the -F 32 argument specifies that this will be the case, rather than FAT16, which is limited to a 2 gigabyte partition.

Attach the Image as a Device

hdiutil attach -nomount your_map_application.dmg

Note the output of this command: if it succeeds, it will report something like /dev/disk3.

Attach USB Drive

Put the USB flash device in your computer's USB port, and then run df in the console and note the output. The leftmost column shows what the device of the USB flash drive is, and the rightmost will show the mount point. Remember the left column (which will be something like /dev/disk1s2) and then run

umount /Volumes/USBDrive

To unmount the drive

Image the drive

Make absolutely sure that the if and of parameters of the following command are accurate; the dd utility is able to write over essential data if you accidentally put the device of another drive in the of parameter.

sudo dd if=/dev/FROM_DISKIMAGE of=/dev/TO_USBDRIVE bs=32k

You can tune the last parameter, bs, which specifies the block size of the transfer operation.

Checking progress

The dd operation that is now running can take a while, and it doesn't provide any status information. However, it can.

Open a new terminal and run

~$ ps aux | grep "dd" tmcw 1797 0.3 0.0 2425520 176 s001 R+ 12:30PM 0:00.01 grep dd root 1698 0.1 0.0 2434768 252 s000 U+ 12:18PM 0:01.67 dd if=/dev/disk2 of=/dev/disk1s2 bs=32k root 58 0.0 0.0 2436444 852 ?? Ss 10:16AM 0:00.04 /usr/libexec/hidd

Note the process id: the first number in the row of your dd process. In the above output, it is 1698. Use this id in the following command.

~$ sudo kill -s INFO PROCESS_ID

Going back to the terminal which is running dd will show a count of how many bytes have been transferred. To get a figure in megabytes, you can use the units utility.

~$ units "70000 bytes" "megabytes"

* 0.066757202
        / 14.979657
        

So, 70000 bytes is 0.06 megabytes.

When dd completes, it will output a summary of how much information was transferred and in what timeframe.