OSM Map On Garmin/Cycle map/Preprocessor

From OpenStreetMap Wiki
Jump to: navigation, search

This is an old version of the Garmin cycle map which uses a preprocessor script. You'll still find it useful if you have an old Garmin that doesn't have .typ file support, for example.

Prerequisites

on Linux

  • Install the Perl modules IO::Uncompress::Bunzip2 from CPAN
    • IO::Uncompress::Bunzip2 depends on Compress::Raw::Bzip2 and IO::Compress::Base; Debian/Ubuntu users can build packages with e.g. dh-make-perl --build --cpan Compress::Raw::Bzip2
    • On Ubuntu you can install these packages with apt-get install libio-compress-bzip2-perl libio-compress-base-perl
  • Download mkgmap and unzip it
  • Download osmcut.*.jar from here, decompress it with gzip -d, and put the .jar in the mkgmap directory
  • Download preprocess.pl from svn, and put it in the mkgmap directory
  • Download cycling-map-features.csv from svn, and put it in mkgmap/resources
  • Download an .osm file from somewhere (e.g. one of these planet.osm extracts)

on Windows

  • Install Active Perl, Package Bundle-IO-Compress-Bzip2 is necessary (use the "Perl Package Manager" to install the module)
  • Download mkgmap and unzip it
  • Download osmcut.*.jar from here, gzip -d it, and put the .jar in the mkgmap directory and rename it with the version number
  • Download preprocess.pl from svn, and put it in the mkgmap directory
  • Download cycling-map-features.csv from svn, and put it in mkgmap/resources
  • Download an .osm file from somewhere (e.g. one of these planet.osm extracts)

Running it

  • perl preprocess.pl yourosmfile.osm (or yourosmfile.osm.bz2)
    • Be warned that this step may take a long time - example times from 2Ghz dual core AMD64: 90 seconds to render Scotland, over 2 weeks to render whole of UK. Memory requirements are large, 1.2GB resident in use at most times.
  • It will create a gmapsupp.img file, which you should copy across to your GPS in the usual way (put it in the Garmin subdirectory)

Troubleshooting

  • If you are getting an error message like "GC Warning: Out of Memory! Returning NIL!", you can edit preprocess.pl and increase the option "-Xmx512M" to e.g. "-Xmx1024M" in the java call. This assumes you have enough RAM for that.
  • If you are getting a "Exception in thread "main" java.lang.NoClassDefFoundError: java.util.Scanner", then you are probably using gcj instead of Sun's Java (check with java -version).
  • If you get the error message "Can't locate IO/Uncompress/Bunzip2.pm... " you have to install the package Bundle-IO-Compress-Bzip2 with the Perl Package Manager. (Windows)
  • If you get an error message that the command rm is not available (using Windows...), replace the rm-commands with del and rm -rf with rmdir /S/Q.
  • "Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/xawt/libmawt.so" or similar - Use the Sun JRE ("update-alternatives --config java" as root in Debian/Ubuntu)

What it does

  • Produces a map with the following features:
    • NCN/RCN/LCN cycle routes are highlighted
    • Other roads are toned down a little
    • Refs are munged so that cycle route numbers are obvious
    • Shows cycle parking and bike shops
    • Filesize of about 32MB for the UK at present, 44MB for Germany (April 2008)
  • Stops you getting lost on the National Cycle Network

What it doesn't

  • Doesn't do cycle node networks, yet
  • There are a few little peculiarities (if you 'mouseover' an unnamed minor road, it will say "County boundary", because that's the style it's using)
  • Display umlauts - it somehow reduces "üöä" to "uoa".

Finding out why it doesn't work

See also

  • Garmin map of Iceland has a cycle map for Iceland and there's a self-contained script for generating it that can be adopted to eat any OSM file given to it
  • OSM Composer - Using the definitions as on cycle_map with typfile support you can make very nice garmin maps with this GUI for Mkgmap and SRTM2OSM