Use OpenStreetMap to create your own Garmin device

Slashdot it! Delicious Share on Facebook Tweet! Digg!
Maciej Bledowski, 123RF

Maciej Bledowski, 123RF

Do it Your Way

The maps provided by the open source OpenStreetMap project are compatible with Garmin navigational systems. Importing these maps is straightforward so long as you bring some basic knowledge, patience, and also experience to the task.

OpenStreetMap (OSM) is the easiest place to look for up-to-date, high quality maps for a Garmin navigational device (Figure 1). If necessary, you can also create a map that includes information you yourself have specially selected.

Figure 1: Garmin devices can be loaded with custom images and maps.

This is actually fairly easy. Loading a ready-made map onto a GPS device gives you all of the data you need along with relevant settings for your next hike or bike tour. Table 1 contains suitable sources (Figure 2). Some of the websites provide updated maps for Garmin devices on a weekly basis, others on a daily basis. Most of the time, all you need to do is load the compressed images and then unpack them in the Garmin/ directory on the device memory card. The device itself has a directory of the same name, but this is not where the images belong.

Table 1

Sources for OSM Maps

Source URL Type
OSM Garmin maps http://garmin.openstreetmap.nl/ Free worldwide Garmin maps
Navmaps http://www.navmaps.eu Individual maps of Europe
OpenFietsmap http://www.openfietsmap.nl Individual maps of Europe
Thkukuk http://osm.thkukuk.de Individual maps of Europe
Free alternatives http://mapas.alternativaslibres.es Complete set of maps for Europe
Spatial reference http://www.raumbezug.eu/osm-garmin.htm Complete set of maps for Europe
Maps for hiking and horseback riding http://www.wanderreitkarte.de Hiking and horseback riding
Figure 2: There a plenty of online resources for OSM maps for Garmin devices.

This approach works in most situations. However, OSM does not always have every feature you desire. Prepared maps represent just a portion of the data that is actually available. On the other hand, flooding a map with data would make it unreadable. As a result, the data you would like to have is frequently not there. In addition, device manufacturers often use a variety of different formats for the maps, trails, routes, and other features on their devices, thus making it difficult to use the features.

Mkgmap

A very special tool called Mkgmap [1] provides the foundation with which you can create Garmin compatible maps. You will find this Java command-line program in the repositories of numerous distributions. The software works by generating Garmin-compatible images that are suitable for direct use on the corresponding devices. Mkgmap does not deliver a preview as part of the results as is clear from a problem that occurs in developing styles. Essentially then, previews are only possible directly on the hardware. There is a small workaround that can help out with this issue.

Since it takes some time to create images and copy them to the hardware, you should definitely start working with a small file of about the same size as a map for an individual county within a state. If the device displays these data in the desired way, then you can try out the next larger unit, such as a map the size of a state. In order to reduce the copy time required for larger and larger files, it is a good idea to avoid using a USB cable when copying the files directly onto the device. Instead, you should use the memory card in the computer. The processors for most GPS devices tend to be feeble, something that becomes apparent when trails and routes get loaded.

You will need an image file called gmapsupp.img for old Garmin compatible devices. You can create this kind of file via the Mkgmap option --gmapsupp . Modern devices differ in that they read image files independently of the way they are named. The decisive factor is whether they are saved to the Garmin/ directory. Newer devices also make it possible to save different details of the map in different images and then use them simultaneously. The newer devices frequently use a file named gmapdem.img for contour lines (DEM stands for Digital Elevation Model) and gmapgc.img for geocoding information. The latter matches locations to addresses and coordinates. The names involve conventions that you can choose as desired.

Basically, it is very easy to create a Garmin device map. First, you should load the required OSM data and convert them using Mkgmap, paying careful attention to the styles. As part of this process, you could potentially create several image files, each of which contains a particular feature of the map like contour lines, bike routes, POIs (see the "POIs" box) ,and other similar things. Then you should copy the images that have been created to the device's Garmin/ folder. Currently, this is pretty much the only procedure available for Linux users. See the "Proprietary Images" box for more information.

Proprietary Images

Garmin uses a form of VFAT-based disc images for the image file format. The filesystem displayed by the file contains a series of partial maps as well as some additional data. Each zoom level is displayed on a set of tiles with the images for this resolution. Garmin does not provide the actual specifications [2]. The format has yet to be completely decrypted [3]. In addition, mounting the disk images is not straightforward. As a result, numerous problems are more difficult to resolve than they might otherwise be.

POIs

POIs refers to Points of Interest. POIs can include buildings, gas stations, museums etc. These might also be significant scenic points of interest.

Mkgmap has a --help=options option that provides basic information about the program. The --help=<Topic> option displays additional details for each keyword. The option names cannot be abbreviated in Mkgmap. Equal signs are required between the option and value. You will only need to use a few of the numerous options available in order to perform most tasks (See Table 2).

Table 2

Getting a Handle on Mkgmap

Option Function
-c <file> Reads the relevant file and interprets the contents line by line as <Option>=<value>
--output-dir=<folder> Writes to the relevant directory
--gmapsupp Creates and reads a Garmin-compatible file
-n <Name> Defines the map name
--description=<Text> Describes the map and its features
--country-name=<country> Defines the country name
--country-abbr=<abbreviation> Defines the country name abbreviation
--region-name=<Region> Defines the region name
--region-abbr=<abbreviation> Defines the region name abbreviation
--style-file=<file> Reads styles from the relevant file
--list-styles Displays available styles
--check-styles Checks the available styles
--route Creates a routing-capable map
--cycle-map Creates a bike route map
--transparent Creates a transparent overlay
--verbose Delivers comprehensive output

Maps and Styles

Styles are an important aspect to the creation of the maps. As with Maperitive [4], the software uses features to classify the display for objects and then draws them accordingly. The objects include such things as points, lines, and surfaces. The styles determine the manner in which this occurs. In particular, a style defines the relationship between the form in which an object appears and the magnification level of the object.

Garmin compatible navigational devices work with a scale of 24 resolution levels. The scale correlates the levels with distance. In practice, only levels 16 through 24 are actually relevant (see Table 3). In addition, the mapping for these levels can vary depending on the device. The zoom levels for the maps are different. In principle, there are 17 levels; these include 0 to 16. However, only the values from 0 (maximum detail) to 10 (overview) are typically used.

Table 3

Resolution

Factor Distance
16 30-12km
18 8-3km
20 2000-800m
22 500-200m
23 300-80m
24 120-50m

An internal table gives the relationship between the zoom level and the resolution. For example, the zoom level 0 corresponds to resolution 24. When calling Mkgmap, you can define which level the map should take into account via the --levels= option. A Garmin navigational map contains a maximum of eight levels. In addition, there are up to eight so-called overview levels. A large number of levels improves the display, but it also eats up storage space for the image files.

A gmapsupp.img file contains its own set of precalculated tiles for each zoom level. You will see the level when navigating. This explains the file size, which often reaches into the gigabytes. Since the filesystem for the image is based on VFAT, problems may occur. The maximum size for VFAT files is 4GB. This becomes an issue primarily when you try to create very large MBTiles files [5] that you then use for an SQLite database. By the way, you can use Maperitive as needed to create the displayed tiles and then embed them in a disk image.

Another problem to consider also involves file size and contents. Mkgmap has restrictions with respect to the size of the datasets that it processes. Therefore, you will need to split large OSM and protocolbuffer binary format (PBF) files. Splitting is accomplished with the second program in the Mkgmap suite, aptly known as splitter [6]. You install this program separately, either by hand or under Arch Linux. Otherwise, the program usually comes in the mkgmap package. You will find the program options via --help . However, the packages in Arch Linux do not come with documentation and examples. As a result, you may have to resort to the original files.

Splitter divides OSM files into smaller files. In the process, it tries to keep neighboring regions together. In addition, the program also attempts to transfer Ways and Polygons as completely as possible to a new file. It does this by creating files of various sizes.

Buy this article as PDF

Express-Checkout as PDF

Pages: 5

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content