Osmcut

From OpenStreetMap Wiki
Jump to: navigation, search

There are at least two programs called osmcut for cutting up .osm-files into smaller parts.

  • osmcut
  • Saved info from OSM Map on Garmin: Use the C version not the Java version which produces invalid output and seems to be no longer maintained. Unfortunately, osmcut.c does not compile and run under either Cygwin or MingW because of problems with mmap.

saved from mkgmap

  • Install and compile osmcut:
$ svn co http://svn.openstreetmap.org/applications/utils/osm-extract/osmcut/
$ cd osmcut
$ make
$ cd ..

(To compile osmcut on my Ubuntu 8.04, I needed libglib2.0-dev package.)

A patched/enhanced osmcut.c which works better (no broken ways which were produced by the one from svn regularly) can be found at osm-talk.

  • Get the OSM file for your area and cut it into smaller files into a dedicated directory (called cut-hexagone/ in the following). For example for France:
$ wget http://hexagone.openstreetmap.fr/hexagone-latest.osm.bz2
$ bzip2 -d hexagone-latest.osm.bz2
$ mkdir cut-hexagone
$ ./osmcut/osmcut --force --destination cut-hexagone/ hexagone-latest.osm
  • Then apply mkgmap on the produced files. We do this into another directory, garmin-map/:
$ mkdir garmin-map
$ cd garmin-map
$ java -Xmx512M -jar ../mkgmap-r590/mkgmap.jar --latin1 --gmapsupp --net ../cut-hexagone/*

You can finally put all the generated files into the garmin-map/ directory onto your Garmin GPS, as previously explained.

Unfortunately, there is a known issue with this solution - a number of short ways which cross the joins of these files will be lost, so your resulting map will not be 100% complete.

See also