NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum


Question asked on IRC.

How can I get a national cycle trail (such as this one in Sweden) converted to a transparent overlay for my Garmin?

asked 17 May '13, 16:37

SK53's gravatar image

SK53 ♦
accept rate: 22%

Working on the assumption that the trail covers most of the country, you need to do the following things (a lot of this follows OSM on Garmin Cycle Map):

  • Download an OSM XML file containing the area of interest. Usually Geofabrik's download site is the best place to start (some alternatives are listed at the end).
  • Download the java program Mkgmap from here.
  • Place the OSM XML file & mkgmap in the same directory. (I usually have a specific directory for garmin work).
  • Create a subdirectory of that directory called, say, ncnstyle. This will be used to store the rules for processing the xml to a garmin img file
  • Download a cycle specific mkgmap style from and place them in the subdirectory. You need all the files from this site (info, lines, options, points, polygons, relations, version). Either save by right clicking in your browser or use svn to get all at once. In windows you may need to open each file with the command line editor and save them to change newlines to windows end of lines.

At this point you have everything you need to create a garmin IMG file, but first we want to change things a little so that only the National Cycle Trail data are processed. There are several options for doing this (by filtering out unneeded data from the OSM file), but here I follow a route where we only process NCN data in the mkgmap style.

Once the style has been changed we now need to use it. The way I do this is as follows

  • Create a batch file (.bat on windows, a shell script under unix). I only do this because I forget all the parameters and it's easier to change than remember the parameters. Enter on one line the following text (replace things IN UPPER CASE with your particular file names) and save it.

java -jar .\mkgmap.jar -c NCNCYCLE.txt OSMDOWNLOADFILE

  • Now create the file NCNCYCLE.txt (again use whatever name you want instead of NCNCYCLE). Here all the mkgmap parameters can be set. The ones I standardly use are as follows:

style-file: ncncycle family-id: 9201 family-name: YOURNAME series-name: YOURNAME tdbfile route lower-case transparent overview-mapname: ncn-test overview-mapnumber: 92010000 mapname: mapname: 92010001 keep-going

The 9201 is used because this is unlikely to clash with any other Garmin maps you have, but it is as well to check beforehand. Further details on these options at mkgmap on the wiki.

Now we edit the style files copied earlier. Because we only want the NCN route and we do not want buildings, POIs, forests etc., replace the two following files with an empty file: points, polygons.

Add the following line to the lines file near the top,

> # ----- Downgrade tracks where bicycles are banned
> #     (ignore motorway/trunk as this'll look stupid)
> bicycle=no & ( highway!=motorway &
> highway!=trunk ) { set
> highway=footway; } access=private {
> set highway=private; }
> ###==== these are the extra three lines, the aim is to suppress all
> output except ncn ==== ### ncn_ref=*
> {add ncn=yes; } (ncn!=yes & highway=*)
> { set ncn=no; } (ncn=no & highway =*)
> {delete highway; delete lcn; delete
> rcn; delete lcn_ref; delete rcn_ref;}

Now run the batch file. It should create 3 files a .tdb and 2 *.img files.

... this answer is incomplete because I'm going to the pub. It should say something about MapSetToolkit. It could do with being edited too.

permanent link

answered 17 May '13, 20:45

SK53's gravatar image

SK53 ♦
accept rate: 22%

If you can live with an intransparent overlay, go to waymarked trails, search for the name of the desired trail, download the GPX file to your Garmin device and set it to show the parts of the track on the map.

permanent link

answered 18 May '13, 04:26

malenki's gravatar image

accept rate: 6%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 17 May '13, 16:37

question was seen: 6,340 times

last updated: 18 May '13, 04:26

NOTICE: is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum