Notes on How to Make a Garmin IMG Contourlines Map

I was dissatisfied with available contourmaps for Garmin. So I made my own.

Below are short notes on how to create an IMG file for a given area of the Earth.

Sequence of steps

Get DEM (digital elevation map) data

Download hgt files from http://www.viewfinderpanoramas.org/dem3.html. Unzip them as needed.

Get the tool

This tool is to convert HGT format to contours that OSM can later chew on.

Generate OSM XML data for contourlines

To have contours every 10 meters with major lines every 50 and 100 meters, and generate binary format files for each input HGT:

phyghtmap --step=10 --no-zero-contour -o prefix -j 4 --line-cat=100,50 --o5m inputdir/*.hgt

Alternatively, phyghtmap can download HGT data files itself, but it will require registration on some governmental agency website.

How to limit generated map to non-rectangular boundary e.g. a country border.

Get polygon boundaries from http://download.geofabrik.de/europe.html in form of .poly file.

To process them in parallel later, use osmconvert with that polygon file:

ls *.osm.gz | parallel --bar osmconvert {} -B=sweden.poly --complete-ways -o=osm/{.}.pbf
Generate combined IMG file for all inputs.
java -jar ~/tmp/mkgmap-r4000/mkgmap.jar
--copyright-message="(c) 2017 Grigory Rechistov CC BY-SA 4.0"
--license-file=/home/ggg/tmp/mkgmap-r4000/license-ggg.txt
--latin1 --verbose --transparent --keep-going
--description="contourlines 10 meter"
--max-jobs=4 --gmapsupp
--style-file=$HOME/contours_meters   *.pbf

Problems with levels

mkgmap may generate files with contourmaps shown on all zoom levels, including very large ones. You’ll actually want to see contours only at levels 22-24 or so, otherwise the zoomed out views become cluttered and unreadable.

Three possibilities to specify levels.

  1. Pass command-line option one time per input file. I do not know if that will work for several thousand inputs of a large map.

  2. Use mkgmap style map that assigns levels to objects. Start from contours_feet as an example

  3. Use .MP files (“polish notation” text map format) which allows to specify zoom levels for every file.


Written by Grigory Rechistov in Uncategorized on 15.01.2018. Tags: garmin, img, contours,


Copyright © 2018 Grigory Rechistov