Today I would like to explain how to create (routable) maps for your Garmin GPS device based on OpenStreetMap data. I am going to show you how to compile the map (for Austria) on a Debian Linux server using the Java Runtime Environment.
Just for clarification, you do not have to compile such maps all by yourself.
Head over to http://wiki.openstreetmap.org/wiki/OSM_Map_On_Garmin/Download and download pre-compile maps.
Step one – get the OpenStreetMap data
First, we have to download OpenStreetMap (OSM) data of the region we want to use for our map.
I guess the easiest way is to select the area you are interested in on the OSM website and click the “Export” button. Then choose XML as type and click “Export”.
Please note that this only works if the area is less then maximum download limit. You get notified if the area is too large.
Another possibility is to download the data from a website called Geofabrik.
Among many different files and information around OSM you can download compressed and up to date (files are updated every night) OSM data of nearly every country on earth.
In this How to I am going to use data prepared by Geofabrik.
Head over to http://download.geofabrik.de/osm/europe/ and download the file “austria.osm.bz2″ (works with other countries too )
Step two – get the tools
We have to use two easy-to-use tools for this job: “mkgmap” and “tile-splitter”.
You can get both tools from the mkgmap website (http://www.mkgmap.org.uk/). I do recommend using the latest version of each tool.
Download the tar.gz file of mkgmap and tile-splitter and extract both in the same directory you downloaded the austria.osm.bz2 file into.
Step three – split it
You can not create a map out of one large tile and therefore you have to split it into several small ones.
Use the following command to start the splitting process:
java -jar splitter-r200/splitter.jar austria.osm.bz2
(If you get the Java “OutOfMemoryError” Error increase the available memory by using the -Xmx parameter (java -Xmx2000M -jar …) )
Depending on your system this might take a few minutes.
If you want you can add a description for the map or a different output directory by using some of the “tile-splitter” parameters. In the end you should find some new files (ending with .osm.pbf) in the directory next to the “austria.osm.bz2″.
Step four – make it
Next step is to take all tiles and build the final file your Garmin device should be able to read and use.
java -Xmx2000M -jar mkgmap-r2227/mkgmap.jar --route --remove-short-arcs --add-pois-to-areas --index --gmapsupp *.osm.pbf
Important is to use “–route” (to get a routable map) and “–gmapsupp” (compile a map for Garmin devices).
mkgmap takes a lot of different parameters and can be tuned to compile a map with different features, layouts and colors. Please consult the mkgmap website/wiki for a summary and detailed explanation. Only the most important options are used here.
Step five – use it
Copy the gmapsupp.img file (should be around 150MB for Austria) to your GPS device.
Depending on the device you can copy it on the internal or external (SD card) storage but please take care not to overwrite the original map on the device.