This page details how to create map files from openstreetmap data for use with your GPS receiver. Firstly, however, it's wise to check that somebody else hasn't already done it for you. Follow the instructions in the downloading maps and combining maps pages to see if that will suffice - if so, you don't need to create your own.
If you do need to create your own map, you can follow the instructions here, taken from the mkgmap page.
The first step is to extract the data from openstreetmap and save the data locally in osm format. There are a few different ways to do this, using either point-and-click tools or from the command line:
With the latest version of the GPS tool GpsPrune, you don't need to use the command line or wget any more, you can just ask GpsPrune to get the OSM data for the appropriate area and save it to file for you. Simply create, draw or load data for the area you want, create extra points to widen the area if necessary, and then select the function to download OSM data. GpsPrune will then save the data using the filename you provide (by default "data.osm"), which you can then convert as described below.
There is now a function within the OpenStreetMap website itself, when you have zoomed into the area you want to download, you can simply select the "Export" function on the top of the screen, select the option "OpenStreetMap XML Data", and then click the "Export" button. You can even draw a rectangle to export with the function "Manually select a different area", or enter your own coordinates.
You can also use the free java program JOSM (a high-powered editor for OSM) to download the area you want, and then save as an OSM file.
For this method you need to know the coordinates of the rectangle you wish to extract, with minimum and maximum longitude and latitude values. You also need to know the format in which to enter these coordinates to use OpenStreetMap's XAPI. For example:
wget http://www.informationfreeway.org/api/0.6/*[bbox=11,47,11.5,47.5] -O data.osm
This complicated-looking command is simply a request for a URL, using the
wget tool - if you haven't got this then you can just paste the URL part into your browser address bar and save the resulting file. The area to extract is defined by the
bbox= part - giving the west, south, east and northern limits of the bounding box in degrees. Here the box goes from 11°E to 11.5°E and 47°N to 47.5°N as an example. Depending on the size of your bounding box, the resulting osm file can be very large indeed (easily several hundred megabytes) and can take some time to download, so check your area before starting the extract.
If this works, you should have a file called "data.osm" (or whatever you called it) saved on your computer. If it doesn't work, check the api number (currently 0.6) and change it if necessary to the latest version. For more information on this, see the OpenStreetMap wiki.
Now that the OSM data has been extracted by one of these methods, The next step is to convert it to img format.
To do the conversion to img format, we will use the free java tool Mkgmap which we already saw in the combining maps section. If you haven't already downloaded mkgmap, you can get it following the instructions given there.
To convert the osm file into img format (and thereby shrink its size considerably!), call the mkgmap program as follows:
java -Xmx512M -jar ~/download/mkgmap.jar data.osm
This calls the mkgmap jar file (stored in the download directory in this example) and passes it the osm file data.osm. The parameter "-Xmx512M" is an optional parameter to increase the amount of memory allocated to the program. In practice this seems essential for any file of non-trivial size.
Because we didn't specify a name for the map here, we get a file with the default filename of
63240001.img - you will almost certainly want to rename this immediately to make it more meaningful.
Also, following the instructions in the downloading maps page, you will need to rename the file to gmapsupp.img for it to be recognised by the Garmin GPS receiver. Or you can use mkgmap again to combine several of your created maps into a gmapsupp.img file for transfer to the receiver.
In the software section there's a new tool to make calling mkgmap a little easier - you can select the file to convert using a normal file selection gui, and then press the button to call mkgmap. It also lets you select the filename for the output rather than being stuck with an 8-digit filename. The tool is called Mkgmapgui and is free. It's written in java so runs on all the platforms on which
mkgmap runs (including Linux, Mac OSX and Windows).