This page is outdated.
Please refer to the command line options documentation of mkgmap for up-to-date information or call
java -jar mkgmap.jar --help
- 1 Specifying Options
- 2 Options
- 3 Troubleshooting
- 4 Using preprocessed bounds for the address index
- 5 Using precompiled sea
You can specify the options in one of two ways:
- On the command line
- In an arguments file
It is possible to combine both methods when running mkgmap.
Options are processed in the order listed on the command line/in the arguments file. You can therefore supply an option, use it for a particular map and then change it for another map.
List the options on the command line in the order you wish to process them. For example:
java -jar mkgmap.jar --tdbfile --route data.osm
You can produce multiple maps using a command line such as:
java -jar mkgmap.jar --tdbfile data1.osm --route data2.osm
List the options in a plain text file, one option on each line in the format "option: value". If there is no value for the option then you can drop the colon. For example the options file may contain:
style-file: mystyle family-name: My map series-name: My map tdbfile gmapi draw-priority: 25 route index split-name-index
This would then be called using:
java -jar mkgmap.jar -c optionsfile.args data.osm
You can specify one or more source files in an options file using
For larger maps you may want to alter some details of the default map. You can use options for this. When using options, you have to put them before the source file name:
java -jar mkgmap.jar [options] data.osm
If you want to set several options it might be easier to put the options into a file and use the -c option (see below).
--help Show the list of help topics available.
java -jar mkgmap.jar --help
--help=topic Show help on a given topic.
java -jar mkgmap.jar --help=options
-c filename The given file is opened and each line is an option setting of the form option:value, just like on the command line, except that there is no leading '--'.
java -jar mkgmap.jar -c options.args data.osm
Example of an option file:
style-file: mystyle family-name: My map series-name: My map transparent tdbfile draw-priority: 25 route index bounds=bounds.zip housenumbers
--input-file=filename Different way to specify the input file. Useful for use in the option file (see -c above).
java -jar mkgmap.jar --input-file=data.osm
--output-dir=directory Where to put the generated files
java -jar mkgmap.jar --output-dir=temp/ ...
--tdbfile Create a TDB file, which is necessary for installing a set of maps in MapSource.
java -jar mkgmap.jar --tdbfile data.osm
-n name ?
--mapname=name Change the name of the map (i.e. the name of the output file). Garmin maps are named by 8 digit numbers - each tile that is loaded into a GPS must have a different mapname. The default is 63240001.img. Enter the number only, not the extension (img), otherwise mkgmap will throw an exception. It is best to change the name if you are going to be making a map for others to use so that it is unique and does not clash with others.
java -jar mkgmap.jar --mapname=12345678 data.osm
--description=text Sets the descriptive text for the map. This may be displayed in QLandkarte, MapSource or on a GPS etc. Within the GPS unit, under Maps->Set-up map you will see that each map tile is labelled with whatever you set in --description. Maximum 20 characters.
java -jar mkgmap.jar --description="My Garmin map" data.osm
--gmapsupp Write a gmapsupp.img file, possibly joining previous gmapsupp.img (you need to copy in the Mkgmap's working directory), that can be uploaded to a Garmin device in USB mode.
java -jar mkgmap.jar --gmapsupp corsica.img cyprus.img mallorca.img malta.img tenerife.img
--ignore-osm-bounds When reading OSM files, ignore any "bounds" elements. Attention: Routing does not work if this option is set!
--draw-priority=Number' When two maps cover the same area, this option controls what order they are drawn in and therefore which map is on top of which. Higher priorities are drawn "on top" of lower priorities.
--transparent Make the map transparent, so that if two maps are loaded that cover the same area, you can see through this map and see the lower map too. Useful for contour line maps among other things.
--version Output program version to stderr.
Garmin devices vary in their ability to display non-English characters and for this reason mkgmap goes to some length to convert characters in labels. By default all accented characters are transliterated into ascii characters where this is possible. This will give a map that is usable in the widest number of places. Options exist to change this. Also see the Internationalisation page.
--latin1 This option allows the use of non-ascii characters in street names to be displayed (for example ä, ó). It is shorthand for --code-page=1252. What is actually supported is hardware-dependent. Some devices can only display ASCII characters, for example. Mkgmap goes to some length to convert un-displayable characters, though, and by default (without this option), it will transliterate characters to unaccented ASCII characters where possible.
java -jar mkgmap.jar --latin1 data.osm
--code-page=number Set the given code page in the generated map LBL header.
java -jar mkgmap.jar --code-page=1252 data.osm
--lower-case Allow labels to contain lower case letters. Note that this doesn't work on many (most?) Garmin devices.
java -jar mkgmap.jar --latin1 --lower-case data.osm
Address search options
--index Generate a global address search index. If the --gmapsupp option is also given, then the index is generated within the resulting gmapsupp.img file so that address search will work on a GPS device.
If both the --gmapsupp and any of --tdbfile, --gmapi, or --nsis options are given alongside the --index option, then both indexes will be created. Note that this will require roughly twice as much memory.
If the map is sent to the device by MapSource, it will enable find by name and address search on the GPS.
The address fields are assigned by special mkgmap address tags using the style file:
mkgmap:country mkgmap:region mkgmap:city mkgmap:postal_code mkgmap:street mkgmap:housenumber mkgmap:phone (mkgmap:is_in - used by location-autofill=is_in)
If the index is created from previously compiled .img files, then the same code page and sorting options (eg. --code-page, --latin1 etc) must be used as were used to compile the individual map tiles.
--bounds=directory|zipfile A directory or a zipfile containing the preprocessed bounds files. Bounds files in a zipfile must be located in the zipfiles root directory.
The preprocessed boundaries are used to add special tags to all elements (points, lines and polygons) containing the elements location information. The style file can be used to assign the address tags mkgmap:country, mkgmap:region etc. using these values.
The following special tags are added:
mkgmap:admin_level2 : Name of the admin_level=2 boundary mkgmap:admin_level3 : Name of the admin_level=3 boundary .. mkgmap:admin_level11 mkgmap:postcode : the postal_code value
The preprocessing of boundary data is described here.
--location-autofill=[ValueList] Controls how the address fields for country, region, city and zip info are gathered automatically if the fields are not set by using the special mkgmap address tags (e.g. mkgmap:city - see option index).
Warning: automatic assignment of address fields is somehow a best guess.
- is_in The is_in tag is analyzed for country and region information.
- nearest The city/hamlet points that are closest to the element are used to assign the missing address fields. Beware that cities located in the same tile are used only. So the results close to a tile border have less quality.
--list-styles Lists the built-in styles that have been pre-compiled into the mkgmap jar file. You can select one of these using the --style= option (see below). Built-in styles are (at version 1838):
control 0.1: A style for traffic control features default 1.0: The default style floodblocker 0.1: A style for controlling the detection of land and sea areas marine 1: Default style + marine objects noname 1: Special map to highlight roads with no name routes 1.0: A style for public transportation routes test 1: No summary available
--check-styles Performs some checks on the available styles. If this option is preceeded by a style-file option then it checks the styles available within that file. If it is also preceded by the style option it will only check that style.
--style=name Specify a different style name, rather than the default. This has to be one of the built-in styles (see --list-styles), if you created an own style, then you have to use --style-file (see below).
java -jar mkgmap.jar --style=noname data.osm
--style-file=file Specify an external file to obtain the style from. The file can be a directory or a zip file containing the style. It can also be a URL. If there is more than one style in the zip file, then the --style argument can be used to select which one. Examples:
java -jar mkgmap.jar --style-file=stylename data.osm
if you created a folder "stylename" in the mkgmap working directory or
java -jar mkgmap.jar --style-file=stylename.zip data.osm
if you created a zip-file "stylename.zip" in the mkgmap working directory. See customisation help.
--name-tag-list=list Changes the tag that will be used to supply the name, normally it is just 'name'. Useful for language variations. You can supply a list and the first one will be used.
java -jar mkgmap.jar --name-tag-list=name:en,int_name,name data.osm
This means that name:en will be used first, then int_name and finally if both of those don't exist then 'name'.
--levels=levels code Change the way that the levels on the map correspond to the zoom levels in the device. See customisation help. The hard coded default is the equivalent of: "0:24, 1:22, 2:20, 3:18, 4:16" although this may change. The maximum number of pairs is 8, more levels will yield an error message.
java -jar mkgmap.jar --levels=0:24,1:22,2:20,3:18 data.osm
--no-poi-address Disable address / phone information to POIs. Address information is read according to the Karlsruhe tagging schema. Automatic filling of missing information could be enabled using the "location-autofill" option.
--add-pois-to-lines Generate POIs for lines. For each line (must not be closed) POIs are created at several points of the line. Each POI is tagged with the same tags like the line and additional tags added by mkgmap: mkgmap:line2poi=true and tag mkgmap:line2poitype having the following values:
- start - The first point of the line
- end - The last point of the line
- inner - Each point of the line except the first and the last
- mid - The middle point
--add-pois-to-areas Generate a POI for each polygon and multipolygon. The POIs are created before the style is applied. Each POI is tagged with the same tags of the area/multipolygon. Additionally the tag mkgmap:area2poi=true is set so that it is possible to use that information in the points style file. Artifical polygons created by multipolyon processing are not used. The POIs are created at the following positions (first rule that applies):
- the first node tagged with a tag defined by the pois-to-areas-placement option
- the center point
- the node with role=label
- the center point of the biggest area
--pois-to-areas-placement[=taglist] A semicolon separated list of tag=value definitions. A POI is placed at the first node of the polygon tagged with the first tag/value pair. If none of the nodes are tagged with the first tag-value pair the first node tagged with the second tag-value pair is used and so on. If none of the tag-value pairs matches or the taglist is empty the center of the polygon is used.
It is possible to define wildcards for tag values like entrance=*.
--make-poi-index. Added r110.
The POI index, which used to be generated by default, doesn't actually appear to be useful at this time. So now it's only generated if you give this option.
--preserve-element-order Process the map elements (nodes, ways, relations) in the order in which they appear in the OSM input. Without this option, the order in which the elements are processed is not defined.
Overview map options
--overview-levels=levels code Like --levels, specifies additional levels that are to be written to the overview map. Counting of the levels should continue. Up to 8 additional levels may be specified, but the lowest usable resolution with MapSource seems to be 11.
java -jar mkgmap.jar --overview-levels=4:17,5:16,6:15,7:14,8:12 data.osm
--overview-mapname=name The actual filename for the overview .tdb and .img file. Must be different from the --mapname parameter (if mapname is 64320001, then --overview-mapname should be 64320000). Default is osmmap.
--overview-mapnumber=8 digit number' If --tdbfile is enabled, this gives the internal 8 digit number used in the overview map and tdb file. The default number is 63240000.
--remove-ovm-work-files If overview-levels is used, mkgmap creates one additional file with the prefix ovm_ for each map (*.img) file. These files are used to create the overview map. With option --remove-ovm-work-files=true the files are removed after the overview map was created. The default is to keep the files.
Product description options
The following options set values that are used in the gmapsupp and TDB files to identify a product. None of these options are required to produce a simple map.
--family-id=number This is an integer that identifies a family of products. If you want to compile a map with a TYP file, you will need to ensure that the family-id of the map matches that of the TYP file. Only one mapset at a time can have the same family-id in Mapsource.
java -jar mkgmap.jar --family-id=2 data.osm
--product-id=number Each mapset needs an unique product-id in order to let MapSource differentiate between the different maps. Default is "42".
java -jar mkgmap.jar --product-id=43 data.osm
--product-version The version of the product. Default value is 1.
--series-name=name This is the name displayed in the 'Select a Product' drop down list in MapSource. If you plan to distribute maps using installers then providing a short map description here is very useful. Default is "OSM map". This value is not transferred to the GPS. When loading multiple maps into QLandkarteGT, each map must have a unique series name, otherwise each map will appear identical to the first map loaded.
java -jar mkgmap.jar --series-name="My OSM Garmin map" data.osm
--family-name=name Family name is displayed on some Garmin units (or at least on eTrex units) on the list of groups of maps (reached by pressing menu on the list of individual maps). In MapSource family-name is shown next to the mapset when you go to the Map Product Manager.
--area-name=name Area name is displayed on Garmin units (or at least on eTrex) as the second part of the mapname in the list of the individual maps.
--description=text Sets the descriptive text for the map or tile. This may be displayed in QLandkarte, MapSource, on a GPS etc.
--country-name=text Sets the map's country name. The default is "COUNTRY".
--country-abbr=text Sets the map's abbreviated country name. The default is "ABC".
--region-name=text Sets the map's region name. By default, the map has no region name.
--region-abbr=text Sets the map's abbreviated region name. By default, the map has no abbreviated region name.
--copyright-message=note Specify a copyright message for files that do not contain one.
--license-file=file Specify a file which content will be added as license. All entrys of all maps will be merged in the overview map.
With mkgmap, it is possible to create routable maps.
--route Create a routable map. You have to use a style that supports routing, for example the default style. Note that if you use --route you don't also need to use --net.
java -jar mkgmap.jar --route data.osm
--net Create an output file that supports "Lock to road" on Garmin devices. Useful for routable maps. Note that if you use --route you don't also need to use --net.
java -jar mkgmap.jar --route --net data.osm
Wherever possible, ensures that turns off to side roads change heading sufficiently so that the GPS believes that a turn is required rather than a fork. This avoids spurious instructions to "keep right/left" when the road doesn't actually fork but actually requires a turn-off.
Optional BITMASK (default value 3) allows you to specify which adjustments are to be made (where necessary):
1 = increase angle between side road and outgoing main road
2 = increase angle between side road and incoming main road
3 = both (Default value)
java -jar mkgmap.jar --adjust-turn-headings=3 data.osm
--make-opposite-cycleways Make opposite cycleways when bicycles can use oneway streets in reverse. Some oneway streets allow bicycle traffic in the reverse direction and this patch makes a way with the same points as the original that allows bicycle traffic (in both directions). Added in version r1044
java -jar mkgmap.jar --make-opposite-cycleways data.osm
--link-pois-to-ways If this option is enabled, POIs that are situated at a point in a way will be associated with that way and may modify the way's properties. Currently supported are POIs that restrict access (e.g. bollards). Their access restrictions are applied to a small region of the way near the POI.
--process-destination When using the Garmin Types 0x08 and 0x09 (low-speed and high-speed Ramp) Garmin is evaluating the first way after all the *_link ways to display the destination of the link. But in the OSM data often only the _link ways are tagged with destination. When this option is set, mkgmap splits all motorway_link and trunk_link ways tagged with destination into two or three parts where the second part is additionally tagged with mkgmap:dest_hint=true. This allows to use any routable Garmin type (except 0x08 and 0x09) for that part, so that the Garmin device tells the name of this part as hint which destination to follow.
--process-exits Usual Garmin devices do not tell the name of the exit on motorways while routing with mkgmap created maps. This option splits each motorway_link into three parts. All parts are tagged with the original tags of the motorway_link. Additionally the middle part is tagged with the following tags:
mkgmap:exit_hint=true mkgmap:exit_hint_ref=ref tag value of the motorway_junction mkgmap:exit_hint_name=name tag value of the motorway_junction mkgmap:exit_hint_exit_to=exit_to tag value of the motorway_junction
Adding a rule checking the mkgmap:exit_hint=true makes it possible to use any routable Garmin type (except 0x08 and 0x09) for the middle part, so that the Garmin device tells the name of this middle part as hint where to leave the motorway.
--ignore-turn-restrictions When reading OSM files, ignore any "restriction" relations.
Sea generation options
--precomp-sea=directory|zipfile Defines the directory or a zip file that contains precompiled sea tiles. Sea files in a zipfile must be located in the zipfiles root directory or in a sub directory sea. When this option is defined all natural=coastline tags from the input OSM tiles are removed and the precompiled data is used instead. This option can be combined with the generate-sea options multipolygon, polygons and land-tag. The coastlinefile option is ignored if precomp-sea is set.
--generate-sea[=ValueList] Generate sea polygons. ValueList is an optional comma separated list of values:
- multipolygon Generate the sea using a multipolygon (the default behaviour so this really doesn't need to be specified).
- polygons Don't generate the sea using a multipolygon - instead, generate a background sea polygon plus individual land polygons with tag natural=land. This requires a suitable land polygon type to be defined in the style file (suggested type is 0x010100) and the polygon must be defined in the TYP file as having a higher drawing level than the sea polygon type.
- no-sea-sectors Disable the generation of "sea sectors" when the coastline fails to reach the tile's boundary.
- extend-sea-sectors Same as no-sea-sectors. Additional adds a point so coastline reaches the nearest tile boundary.
- land-tag=TAG=VAL Tag to use for land polygons (default natural=land).
- close-gaps=NUM Close gaps in coastline that are less than this distance (metres)
- floodblocker Enable the flood blocker that prevents a flooding of land by checking if the sea polygons contain streets (works only with multipolygon processing)
- fbgap=NUM Flood blocker gap in metre (default 40) points that are closer to the sea polygon do not block
- fbthres=NUM At least so many highway points must be contained in a sea polygon so that it may be removed by the flood blocker (default 20)
- fbratio=NUM Only sea polygons with a higher ratio (highway points * 100000 / polygon size) are removed (default 0.5)
- fbdebug Switches on the debugging of the flood blocker generates GPX files for each polygon checked by the flood blocker
--coastlinefile=filename[,filename] Deprecated option. Defines a comma separated list of files that contain separate coastline data. The coastline data from the input files are removed if this option is set. Files must have OSM or PBF fileformat.
--block-size=number Changes the block size that is used in the generated map. There is no general reason why you would want to do this.
--keep-going Continue processing when a job fails.
java -jar mkgmap.jar --keep-going data.osm
--max-jobs=number Request concurrent processing of maps. Processing of the maps is handled concurrently by a pool of top-level threads. The number of threads in the pool can be specified explicitly with the --max-jobs=N option. Specifying just --max-jobs will set the number of threads equal to the number of CPUs available. Added in version 1057
java -jar mkgmap.jar --max-jobs=2 data.osm
Contours were added in r1079. They were removed in r1080 as they do not compile without extra packages. You can use tools like srtm2osm or phyghtmap in combination with splitter to compute input files for mkgmap.
mkgmap has a built-in feature to make a map containing all(?) possible points, lines and polygons. This is useful to see how different Garmin types looks like.
export BASE_LAT=50.0 export BASE_LONG=10.0 java -jar mkgmap.jar test-map:all-elements
If some commands do not work, try to put them before the data file, so enter
java -jar mkgmap.jar [options] data.osm
java -jar mkgmap.jar data.osm [options]
This is because the commands are read sequentially; so mkgmap has to read the options before the data file. Therefore, it is also possible to process multiple files in one command:
java -jar mkgmap.jar --mapname=10000001 data.osm --mapname=10000002 data2.osm
Mkgmap first sets the map name to 10000001, then processes data.osm, then sets the map name to 10000002 and finally it processes data2.osm.
If map generation fails or the map does not work try to enable assertions by adding the java -ea parameter. This enables more internal error checks but is slower.
java -ea -jar mkgmap.jar [options] data.osm
Using preprocessed bounds for the address index
mkgmap can knit together map tiles and "preprocessed boundaries" files to create maps containing addressing information. Examples of addressing information are zip codes and city names. The addressing information can then be used, for example, by a GPS plotting a route between two points. Preprocessed boundary files are necessary because individual map tiles often lack some information about a boundary. For example, two adjacent tiles might each contain half of a city.
Creating preprocessed boundaries files is a two step process. First, boundary data has to be filtered out from a raw OSM dump. Second, this filtered data is converted into boundaries files.
Clarification needed: It is important that the boundaries are completely contained in this dump. For example, the Geofabrik europe dump does not work for Spain because it is missing some parts of the southern spanish border which is located in Africa.
Filter Boundary Data
Boundary data can be filtered using Osmconvert and Osmfilter or Osmosis. Osmconvert and osmfilter are relatively fast, but the resulting boundary data contains unused stuff that eats memory when creating boundary files. Osmosis is relatively slow but more memory-efficient.
To use osmconvert and osmfilter:
$ osmconvert europe.osm.pbf -o=europe.o5m $ osmfilter europe.o5m \ --keep-nodes= \ --keep-ways-relations="boundary=administrative =postal_code postal_code=" \ -o=europe-boundaries.o5m
This creates a file called
To use osmosis:
$ osmosis \ --read-pbf file=europe.osm.pbf outPipe.0=data1 \ --read-pbf file=europe.osm.pbf outPipe.0=data2 \ --tag-filter accept-relations boundary=administrative,postal_code inPipe.0=data1 outPipe.0=6 \ --used-way inPipe.0=6 outPipe.0=7 \ --tag-filter reject-relations inPipe.0=data2 outPipe.0=8 \ --tag-filter accept-ways boundary=administrative,postal_code inPipe.0=8 outPipe.0=9 \ --used-node inPipe.0=9 outPipe.0=10 \ --used-node inPipe.0=7 outPipe.0=11 \ --merge inPipe.0=10 inPipe.1=11 outPipe.0=12 \ --write-pbf file=europe-boundaries.osm.pbf omitmetadata=true compress=deflate inPipe.0=12
This creates a file called
Create Preprocessed Bounds
mkgmap itself is used to create preprocessed boundary files. For example:
$ java -cp mkgmap.jar \ uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreprocessor \ <inputfile> \ <boundsdirectory>
<inputfile> is the file created by osmfilter or osmosis. In our example, it would be either
<boundsdirectory> contains the preprocessed boundary files created by mkgmap. If the directory does not yet exist, it will be created. If you're following Mkgmap/help/How_to_create_a_map#Walkthrough, the directory should be called "bounds".
Using precompiled sea
Using precompiled sea makes process of generating maps faster and more robust. First you have to generate precompiled sea or download it from navmaps.eu.
You can use them with:
java -jar mkgmap.jar --precomp-sea=<path_to_sea-directory> --generate-sea data.osm
generating precompiled sea yourself
The PrecompSeaGenerator reads a shapefile containing land polygons and creates precompiled sea tiles that can be used by mkgmap to create the land and sea areas of a map. Land polygons can be downloaded from other sites e.g. openstreetmapdata.com. It's better to use the split ones because they are not so memory exhaustive.
The PrecompSeaGenerator can be started with:
java -cp <mkgmap classes>;<libs> uk.me.parabola.mkgmap.sea.optional.PrecompSeaGenerator <shapefile> <projection> <outputdir>
- shapefile: The .shp file of the ESRI shape files containing land polygons. Sea polygon files are not supported.
- projection: The projection used in the shapefile (e.g. WGS84 or EPSG:3857)
- outputdir: The directory where the precompiled sea tiles are stored.
The PrecompSeaGenerator is not included in the mkgmap.jar due to additional dependencies. The following libs must be added in order to run the PrecompSeaGenerator tool:
- Geotools library (http://sourceforge.net/projects/geotools/files/):
- Splitter (http://www.mkgmap.org.uk/page/tile-splitter):