Outdoor sport or field work, a GPS has become indispensable. But what if you want to use your own maps? If you are using an Android smartphone and one of the map viewers available on android market, this is fairly easy. You’ll need your favorite GIS application (e.g., GRASS or QGIS), Maptiler, and Mobile Atlas Creator (MOBAC).
1) Create georeferenced image of your map
First step is to create a georeferenced image of the map you want to use. Maptiler, which we are going to use in the next step, supports many formats, including TIFF/GeoTIFF, MrSID, ECW, JPEG2000, Erdas HFA, NOAA BSB, and JPEG. Most GIS programs will have the option to export your raster data in at least one of these formats.
2) Created tiled map
Next step is to create a tiled map using Maptiler. The steps are kind of obvious; just follow the steps of the MapTiler wizard. But make sure in the first step to select “Google Maps compatible (Spherical Mercator)”. This is the projection expected by Mobile Atlas Creator, the program we are going to use later on. Next you need to select the spatial reference system of your input layer. Note that rendering the map may take some time, depending on the size of the map and the zoom levels to be created. The output is a set of folders, which contain the map tiles, and a doc.kml file.
3) Convert the tiled map in the required format
Converting can be done in MOBAC, which creates atlases for several applications. To convert your tiled map, you need to make sure MOBAC can find it. Unfortunately, this is not very straightforward to do. One of the folders in the MOBAC program folder is the ‘mapsources’ directory (see image below).
MOBAC looks in this directory for custom map sources. These are simple xml files that define the location of the tiled map, and some other parameters which tell MOBAC how to process the map. The readme file in the MOBAC program folder provides a link to an example sources xml file (which might differ depending on the MOBAC version you are using).
3a) Create map source file and select in MOBAC
As an example, I adapted this file to create a map source file pointing at a tiled vegetation map of southwest Kenya in the folder /home/paulo/vegetationSWKenya. Short explanatory notes are given in green, but see the original example xml file for more detailed explanatory notes:
<?xml version="1.0" encoding="UTF-8"?> <localTileFiles> <!-- Give map source name to appear in the map sources list in MOBAC. --> <name>Vegetation map SW Kenya</name> <!-- Directory in which the existing atlas is located. --> <sourceFolder>/home/paulo/vegetationSWKenya</sourceFolder> <!-- Optional: reverse directory structure format to zoom/y/x --> <flipXYDir>false</flipXYDir> <!-- Optional: MOBAC expects by default that the tile scheme starts north and increase towards south. This is the open-source TMS (Tile Map Service) scheme. However, tiles created by Maptiler follow the Google XYZ scheme, which starts south and increases towards north. By setting the invertYcoordinate below to true, the y coordinate is inverted so that it starts south (min=0) and increases towards north (max=2^zoom -1) --> <invertYCoordinate>true</invertYCoordinate> <backgroundColor>#000000</backgroundColor> </localTileFiles>
After you create the file open MOBAC. In the dropdown menu 'map source' you should find the map source name you have just defined ( in my example; Vegetation map SW Kenya - marked 1 in the image below). Select this map source.
3b) Set zoom level
The other options you need to set are the zoom levels (2 in Figure 2). The available zoom levels are the same (obviously) as you have selected when creating the map in Maptiler. So you probably want to select all zoom levels.
Leave the the next option (3 in Figure 2) empty, I don't think there is no need to recreate or adjust your map tiles.
3c) Select that area of interest
The next option is to select the area for which you want to create the mobile map. This is probably the same area covered by the map you created in Maptiler. Note that unless your map aligns perfectly with the TMS tile grid at the lowest zoom level, the area for which the atlas will be created is larger then that covered by your map. You can check how much white space you will have around your map at the different zoom levels by first selecting the map area, and then changing the grid zoom level of the TMS tile grid .
3d) Determining the atlas context
Under the box 'atlas content' select the 'new' button, and in the popup menu, select the map format (Figure 4). The format will depend on the map viewer application you are using. For example, I am using Locus map viewer, which works with the 'RMaps SQLite' format.
You will see now 'unnamed' atlas with between brackets the map format in the atlas content box. Right clicking on the name gives you the option to change the name. You probably want to do this as this will be used as the name of the output file.
3e) Create atlas content
Type in a name in the 'Name' field below and click on the 'add selection' button. You will now be presented with the atlas content, with the different zoom levels, as in Figure 5.
As the last step, you push the 'create atlas' button and your map will be created in the folder 'atlases' in your MOBAC program folder (see Figure 1). In my case, this is the file 'Custom SWKenya vegetation atlas.sqlitedb'. You can copy this file to your android device. To know to which folder, check the documentation of your map viewer. For Locus, this is the folder 'Locus>maps'.
It does require a few steps to get there, which makes me wonder if there aren't easier ways to do this (let me know if you know of any)... but in any case, it gets the work done.