From OpenStreetMap Wiki
Jump to navigation Jump to search
This page describes a historic artifact in the history of OpenStreetMap. It does not reflect the current situation, but instead documents the historical concepts, issues, or ideas.
Osmcut was a tool to cut an OSM XML file into smaller parts.
Reason for being historic
It was developed in 2008 and not ported onto OSM API 0.6 (going live in April 2009). Therefore, it can only be used with planet files prior to April 2009.
Captured time
February 2020

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