Activity Workshop
 

OSM Wrangler

In the creating maps page, instructions are given how to obtain an OSM file and convert it to an IMG file for use in a GPS receiver. The Mkgmap GUI can make this easier to act as a GUI frontend to the mkgmap tool.

Occasionally you may want to customize the OSM file to your own requirements before conversion, and this is where this OSM wrangler tool comes in. It allows you to remove all amenities of the specified type(s) if you don't care about them. For example, you can remove all payphones and all postboxes, if you don't need them in your map, to stop them from cluttering up your view of the town centre. Or if you don't have a car, you can remove all the car parks and petrol stations, for example.

Download

Jar file

Runnable code plus source code (5 kb)
osmwrangler.jar - Complete tool including source code

Installing

There isn't any installation, you just need to download and save this jar file.

Running

You have to run this tool from the command line. The command to run it looks like this:

java -jar osmwrangler.jar inputfile.osm telephone parking > outputfile.osm

This example takes the specified osm file inputfile.osm and removes the two specified amenity types "telephone" and "parking". Finally, the output of the program is redirected (using the ">" operator) to a new osm file called outputfile.osm.

Amenities

A full list of the amenity names and their descriptions is given in the openstreetmap wiki.

Mkgmap styles

Note: Since this OsmWrangler tool was published, it has been discovered that the same effect can be done using Mkgmap styles. This is a fairly unintuitive process, particularly since Mkgmap doesn't always complain when it can't find the specified style file, but it is possible. All you need to do is copy the "default" style directory, and then in the copy, edit the "points" file and remove the lines for the amenities you want to remove. Then run mkgmap and specify the style directory using the "--style-file=" parameter.

Further development

Work has started on a complete rewrite of OsmWrangler, with greatly extended capabilities. The next one is written in python rather than java, but still just a command-line tool (no gui). More details on the motivation and progress are given in version 2.