As many big fans of outdoor adventures, I’m using a Garmin GPS watch with maps. The great thing about Garmin is its “open” system. Basically, you can pimp your device easily. The main advantage is on mapping setup. By default, the devices are loaded with Garmin maps which are not updated automatically, and which are not available (or very poor) in some parts of the world.
I made the choice to upgrade my Garmin watch with OpenStreetMap which is much better in many cases, and available everywhere.
The process is a little bit technical but not much. I will try to explain and make it clear. By following the below steps 👇, you will be able to create new maps “on-demand”.
Let’s go!
(This is made for Linux and Mac users. Windows users may have to update commands)
Prerequisites
First, we need to collect everything which is needed to work. My advice is to create a dedicated folder with a specific architecture :
/MyRootFolder
|- /My
|- /Sub
|- /Folders
Download last mkgmap
mkgmap is a useful program that makes easier the creation of .img files which are used on Garmin devices.
Download the last version here
Extract the file and place it in your MyRootFolder
. To make it easier you can rename it as mkgmap
.
Download tile splitter
The tile splitter is another program provided by mkgmap. It will split the tiles into smaller ones to make the work easier and faster for the machine.
Download the last version here
Extract the file and place it in your MyRootFolder
. To make it easier you can rename it as splitter
.
Download the style for the map
We are going to use the classic “cyclemap” style. To make it possible we are going to use a .typ
file which is like a CSS file for Garmin maps.
You can download the latest version on OSM subversion :
https://svn.openstreetmap.org/applications/utils/export/garmincyclemap/network/cyclemap.TYP
Check Java version
The minimum version required is 8, you can check by using this command line (you can update Java here) :
java -version
Now everything is ready to start generating our own maps, your root folder must be similar to :
/MyRootFolder
|- /mkgmap
|- /splitter
|- cyclemap.TYP
Is it ok? Congratulations 🎉 Now let’s start the creation of the maps 🗺 !
Creation of the map file
Select the geographical area
The first step is to select the geographical area we need. We are going to generate a .pbf
file. To make it simple, this file will embed geodata about the selected area. As the amount of data can be huge, it’s better to select only a small part of the world like a country or a region. Keep in mind that if you want to process an entire continent, it will require a powerful machine.
We are going to use Geofabrik, a simple online .pbf
file generator.
Go to: http://download.geofabrik.de/ and download the file for the selected country.
Each country, depending on its amount of data, will have a specific (sometimes huge !) size. For this example, I will use the Iceland data (here 47Mb).
We download this file and we place it in the MyRootFolder
. To make our work simpler, we can create a /work
folder, and place this file inside.
Now our work folder must be similar to :
/MyRootFolder
|- /mkgmap
|- /splitter
|- cyclemap.TYP
|- /work
|- iceland-latest.osm.pbf
Is still ok? Great! Let’s start the map generation.
Split the country file into several tiles
Starting from now, we are going to use mkgmap program. In case you want to understand all the options and parameters, you can go directly to the documentation. I kept this example simple.
We open the terminal into our /work
folder. And launch this command :
java -Xmx1024m -jar ../splitter/splitter.jar --max-nodes=900000 iceland-latest.osm.pbf
It’s going to create several tiles in the same folder.
Create Garmin img files
Now we are going to create img file for each tile which has been created from the previous command. By running the following command, you will see new .img
files in your /work
folder.
java -Xmx1024m -jar ../mkgmap/mkgmap.jar --style-file=../mkgmap/examples/styles/default --route --net -c template.args
This step could take several minutes depending on the number of tiles to convert.
Compile everything into 1 single “img” file
This is the last step! We are going to create the final file you will use in your Garmin device.
By running this command line, you will merge all your .img
files into a single one.
java -Xmx1024m -jar ../mkgmap/mkgmap.jar --gmapsupp *.img ../cyclemap.TYP
A new file gmapsupp.img
is created at the root of your /work
folder. Congratulations 🎉 This is the file you have to load into your device. We can now enjoy some great adventures in Iceland 🇮🇸 .
Want to go deeper?
This example is very simple. You can do much more: alternative and custom styles, elevation lines, more options for naming and map descriptions…
Many resources are available on OSM Wiki.
Useful links: