cferrero.net      

Mapping la vida loca

 

 Home

 Photos

 Videos

 Maps

 About

How to create free maps for your Garmin GPS unit: a step-by-step guide

Introduction

This page explains, step by step, how to create a routable Garmin gmapsupp.img file that you can upload to your GPS unit. The main assumption is that you want to generate the map yourself, rather than rely on one of the pre-built maps (e.g. from Lambertus' excellent site). If you want to do more advanced stuff see my other pages (particularly, modify styles and custom TYP files).

The following instructions assume a modicum of familiarity with computers and that you are using Windows. At the very least, you have to be able to know how to install software and open the command prompt.

Finally, there are a whole host of complexities you can add to splitting and map-making...if you want more details start at the FAQ, then if that doesn't solve it have a read of my tiddly_wiki which is an ongoing compilation of the millions of command-line options for splitter and mkgmap, and of various other ancillary tools and processes (e.g. adding contour lines).


Installing the right software.

This is just a matter of downloading a few files and placing them in a directory that you'll remember. To make things simple to start with, I recommend placing the unzipped mkgmap.jar and splitter.jar in the same folder as your OSM data. Later on, you can experiment with batch files and relative paths.
  • Download and unzip splitter. Splitter takes a chunk of OSM data and splits it into tiles that are small enough for mkgmap to work on (mkgmap crashes if you give it too much data). Recent versions of splitter work directly with .pbf files, which are a compressed, binary form of OSM data. These are preferable as they are much smaller than the .osm.gz files which you can also get, thus saving download bandwidth and time. At the time of writing, the most recent version of splitter was r174.
  • Download and unzip mkgmap. mkgmap takes OSM data (as individual tiles, if you have already run splitter) and renders it into a Garmin img file that you can load into your GPS unit.
  • If you don't already have it, install java (you probably do already have it).

Download map data

We'll use OpenStreetMap for data. Rather than interact with OSM directly, we'll download a pre-made extract (done by someone else). This is simply a chunk of the total planet-wide map for a specific area. A reliable source that I use is geofabrik. The remainder of this how-to explains how to create a map for the UK - swap this for any particular geofabrik extract you want.
  • Create a new folder: let's call it UK.
  • Download the latest UK extract from geofabrik (scroll down and download the great_britain.osm.pbf file) and save it in the UK folder
  • Copy (or move) splitter.jar and mkgmap.jar into the UK folder.

Splitting the OSM data into smaller tiles

  • Open a command prompt, navigate to this same folder (UK) and type:
    java -Xmx1500m -jar splitter.jar --max-nodes=1100000 great_britain.osm.pbf
    • -Xmx1500m sets the amount of memory reserved for splitter. You can reduce or increase this (bearing in mind that it's in megabytes, so if you use -Xmx1500m you need at least 1.5 Gb of spare RAM.
    • --max-nodes=1100000 sets the number of nodes in each tile. If you omit this switch, splitter will use a default value of 1600000 (1.6 million). On my computer, rendering a UK map, this results in tiles that are too big for mkgmap, but 1100000 works fine. You could start by omitting this switch; if mkgmap crashes, try including it and using a lower number, e.g. 1100000. If you see lots of "Area to small to split" messages whilst mkgmap is running, this is a hint that you should decrease the --max-nodes value.
    • --cache=./cache tells splitter to use (if it exists) or generate (if it doesn't) a cache that will speed up splitting in future (NB no longer needed when using PBF input files).
    • great_britain.osm.pbf is the name of file you want splitter to work on.
  • If all goes well, splitter will terminate OK. You will find that the folder now has a number of .osm.gz files, labelled 6324001.osm.gz, 6324002.osm.gz etc. You will also see a new file called template.args and another called areas.list. For more on these files, read a more detailed description of splitter here

Convert the osm files into a Garmin image file

  • Run mkgmap using the following command
    java -ea -Xmx1500m -jar mkgmap.jar --route --gmapsupp -c template.args
    • -ea Is a switch to jave to enable assertions (which produces more verbose output which can be informative).
    • -Xmx1500m is discussed above.
    • --route Enables routing (i.e. renders the map in such a way that you can get your Garmin unit to create a route between two points for you)
    • --gmapsupp Makes mgkmap create a single gmapsupp.img file (which your GPS will need), as well as individual files for each of the tiles created by splitter (which MapSource will need)
    • -c template.args Tells mkgmap to use the set of tiles previously created by splitter and listed in the template.args file

Almost finished! The last step is easy. Copy the gmapsupp.img file into the Garmin folder of your GPS's memory card. Be aware that if you already have maps on your Garmin, they will be wiped out by doing this. Best to take a copy of whatever was already on your memory card before you start. In my case, I had no maps on my unit, so had nothing to lose.

If you want to install the maps into MapSource, have a read of this

  Copyright 2005-2009 All Rights Reserved cferrero.net