Create mobile maps

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).

Edit: If your app can read MBtiles, there is an easier way, especially if you want to create a map made up of different data layers: read more…

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).

Figure 1: MOBAC program folder with the mapsources sub-folder

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.

Figure 2: MOBAC with the map source ‘vegetation map SW Kenya selected (see red arrow). The map shows in the canvas on the right. The red grid are the outline of the TMS tiles at the grid zoom level selected

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 .

Figure 3: Selection of the area for which you want to create the mobile map.

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.

Figure 4: Select map 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.

Figure 5: Atlas content created

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’.

The map shown in Locus on my Android telephone

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.

About these ads

About pvanb

I am a tropical forest ecologist with a focus on spatial and temporal patterns and processes at population and ecosystem level. I am furthermore very interested in issues related to conservation and sustainable use of biodiversity and natural resources under current and future climates. I have worked in the Middle East (Syria and Lebanon) and South America (Brazil) and in Eastern Africa (Kenya).
This entry was posted in Android, GIS, Mobile tools and tagged , , , , , , . Bookmark the permalink.

4 Responses to Create mobile maps

  1. Pingback: Using TileMill to create maps in mbtiles format | Ecostudies

  2. Paul Donchak says:

    Where does MOBAC find projection info within MapTile output? I can point MOBAC at the folders of PNG files but nothing can be displayed.

  3. Brian says:

    I have a problem getting from TileMaker to MOBAC. Tilemaker has created the folders with png files, and I have set up the xml file in the mapsources folder pointing to the appropriate directory. MOBAC shows my entry in the map source folder, but when I select it I get red crosses in all of the tiles. There is no obvious way of troubleshooting this. Problem seems similar to that described by Rocky https://sourceforge.net/apps/phpbb/mobac/viewtopic.php?f=1&t=232 . Any ideas? Thanks — Brian

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s