JA:Mkgmap/help/options

From OpenStreetMap Wiki
Jump to: navigation, search
利用できる言語 — Mkgmap/help/options
· Afrikaans · Alemannisch · aragonés · asturianu · azərbaycanca · Bahasa Indonesia · Bahasa Melayu · Bân-lâm-gú · Basa Jawa · Basa Sunda · Baso Minangkabau · bosanski · brezhoneg · català · čeština · corsu · dansk · Deutsch · eesti · English · español · Esperanto · estremeñu · euskara · français · Frysk · Gaeilge · Gàidhlig · galego · Hausa · hrvatski · Igbo · interlingua · Interlingue · isiXhosa · isiZulu · íslenska · italiano · Kiswahili · Kreyòl ayisyen · kréyòl gwadloupéyen · Kurdî · latviešu · Lëtzebuergesch · lietuvių · magyar · Malagasy · Malti · Nederlands · Nedersaksies · norsk bokmål · norsk nynorsk · occitan · Oromoo · oʻzbekcha/ўзбекча · Plattdüütsch · polski · português · română · shqip · slovenčina · slovenščina · Soomaaliga · suomi · svenska · Tiếng Việt · Türkçe · Vahcuengh · vèneto · Wolof · Yorùbá · Zazaki · српски / srpski · беларуская · български · қазақша · македонски · монгол · русский · тоҷикӣ · українська · Ελληνικά · Հայերեն · ქართული · नेपाली · मराठी · हिन्दी · भोजपुरी · অসমীয়া · বাংলা · ਪੰਜਾਬੀ · ગુજરાતી · ଓଡ଼ିଆ · தமிழ் · తెలుగు · ಕನ್ನಡ · മലയാളം · සිංහල · བོད་ཡིག · ไทย · မြန်မာဘာသာ · ລາວ · ភាសាខ្មែរ · ⵜⴰⵎⴰⵣⵉⵖⵜ ⵜⴰⵏⴰⵡⴰⵢⵜ‎ · አማርኛ · 한국어 · 日本語 · 中文(简体)‎ · 中文(繁體)‎ · 吴语 · 粵語 · ייִדיש · עברית · اردو · العربية · پښتو · سنڌي · فارسی · ދިވެހިބަސް
その他の言語このウィキの翻訳を支援してください
Mkgmap
Help
Routing
i18n
Known issues
Development
Download maps

このページは最新版ではありません。

mkgmap についての最新情報は command line options documentation を参照するか、下記のコマンドを実行してみてください。

java -jar mkgmap.jar --help 


オプション指定

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
transparent
tdbfile
draw-priority: 25
route
remove-short-arcs

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

input-file: data1.osm

mkgmap supports input files in the OSM XML format, PBF, o5m and polish(.mp) formats.

オプション

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 与えたtopicのヘルプを表示します。

java -jar mkgmap.jar --help=options

-c filename コマンドラインオプションの代わりに、設定ファイルを指定します。与えたファイルは開かれ、各行が option=value の形でオプション設定が与えられている物とします。 これは単にコマンドラインから最初の'--'を除いた物です。

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
net
route
remove-short-arcs

--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 .tdb ファイルを書く。 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 地図の名前を変えますます(i.e. 出力ファイルの名前)。Garmin 地図は8桁の数字で名前が付いています。デフォルトは63240001です。あなたが地図を他人が使うために作るのなら、名前を変えたほうがいいです。そうすると、他の地図と同じ名前にならず、衝突を避けられます。

註: ".img"拡張子のない名前だけを入れてください。そうしないと例外を出して終わります。
java -jar mkgmap.jar --mapname=12345678 data.osm

--description=text 地図の説明文を設定します。これは、 QLandkarte, MapSource, GPSなどに表示されます。 GPS装置の Maps->Set-up map でラベル付けされたタイルマップの説明文を見ることができます。最大20文字です。

java -jar mkgmap.jar --description="My Garmin map" data.osm

--gmapsupp Garmin のUSB モードでアップロードすることができる gmapsupp.img ファイルを書く。

java -jar mkgmap.jar --gmapsupp corsica.img cyprus.img mallorca.img malta.img tenerife.img

--ignore-osm-bounds OSM ファイルを読むとき、全ての"bounds" 要素を無視する。 Attention: Routing does not work if this option is set!

--draw-priority=Number' 2つの地図が同じ地域をカバーするとき、このオプションは、地図の描かれる順番を制御し、どちらの地図が上に描かれるかを決めます。高い優先度(priority)を与えられたほうが、低いものの"上に"描かれます。

--transparent 地図を透過性にします。これにより、同じ地域をカバーする二つ以上の地図を読み込み、この地図を通して、下の地図を見ることができます。等高線地図をこうすると便利です。

--version プログラムのバージョンを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

このオプションは、ASCII文字でない道路名を使うことを許します。これは、GPSユニットが本当に対応しているかによります。例えばいくつかのデバイスは、ASCII文字しか使えません。

Mkgmap は、表示できない文字の変換としていくらかの空白を与えますが、デフォルト(このオプションを指定しないとき)は、アクセントのないASCII文字にできれば変換しようとします。

java -jar mkgmap.jar --latin1 data.osm

--code-page=number マップのLBLヘッダに、与えられたコードページを使います。

java -jar mkgmap.jar --code-page=1252 data.osm

--lower-case 小文字を含むラベルを使うことを許します。でも、ほとんど(全て?)のGarminデバイスでは機能しません。

java -jar mkgmap.jar --latin1 --lower-case data.osm

アドレス検索オプション

--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 instead the --tdbfile option is given then the index consists of two files named osmmap.mdx and osmmap_mdr.img which can be used with mapsource. (For compatibility, you do not need the tdbfile option if gmapsupp is not given).

If both the --gmapsupp and --tdbfile options are given alongside the --index option, then both indexes will be created. Note that this will require roughtly twice as much memory.

The --overview-mapname option can be used to change these names. If the mapset is sent to the device from 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 デフォルトでないスタイルの名前を指定します。 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 スタイルファイルを得るために、外部ファイルを指定します。"file" はスタイルファイルを含むディレクトリーやzipファイルでもいいです。URLでもいいです。もし、zip ファイルに1つ以上のファイルがあるなら、--style オプションで選びわけることができます。後方互換のために、map-features.csv ファイルも指定できます。 例:

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. customisation helpを見てください。

--name-tag-list=list 名前を与えるのに使われているタグを得る。多言語化されている地域では便利。リストを与えると、はじめにマッチした名前が使われる。例えば、--name-tag-list=name:ja,int_name,name などとする。

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 デバイスのズームレベルに連動する地図のレベルを変えます。customisation helpを見てください。 初期値は、"0:24, 1:22, 2:20, 3:18, 4:16" ですが、変更になると思います。 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):

polygons:
  • the first node tagged with a tag defined by the pois-to-areas-placement option
  • the center point
multipolygons:
  • 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=*.

Default: entrance=main;entrance=yes;building=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.

--road-name-pois[=GarminCode] 名前のついた道路にPOIを生成する。初期値では、POI の Garmin タイプコードは、 0x640a です。変えたければ、このオプションで、違うコードを指定することができます。

マップ表示オプション

--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.

プロダクト記述 オプション

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

製品ファミリーのIDを整数値で与える。

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 ファミリー内のプロダクトIDを整数値で与える。通常は、1 になる。 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 国の名前を設定します。デフォルトは"UNITED KINGDOM"です。

--country-abbr=text 国の略称を設定します。デフォルトは"GBR"です。

--region-name=text 地域の名前を設定します。デフォルトは無名です。

--region-abbr=text 地域の略称を設定します。デフォルトは無名です。

--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 Garmin装置の"lock to road" オプションをサポートするアウトプットファイル。. 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

--frig-roundabouts=factor Added r881 Adds an extra point between each pair of adjacent nodes in a roundabout. The extra points are positioned "outside" of the line joining the two nodes. The effect is to make roundabouts "rounder". Unfortunately, it also makes them ugly as the frigging is being done by computer with little aesthetic capability. By default the "frig factor" (influences how far the new points are away from the centre of the roundabout) is set to 0.25. You can specify a different value as the option value: --frig-roundabouts=0.1

  • Large values tend to make the roundabout uglier so it would be worth experimenting to see what the minimum frig factor is that will stop the gps from reporting the wrong exit.
  • You can also enable frigging for an individual roundabout by tagging the OSM XML with the "mkgmap:frig_roundabout" tag which can either be set to a valid (floating point) number to specify the frig factor or just some other string that will make it use the default frig factor.
  • This also avoids putting in new points if the new point would be less than 5 or more than 100 metres from the adjacent points.
java -jar mkgmap.jar --route --frig-roundabouts=0.2 data.osm

--remove-short-arcs Enable short arc removal. Due to the limited precision of coordinates, very short arcs (say, less than about 3m) can become zero length and that causes routing to fail. This option will remove those short arcs by merging the node at one end of the arc into the node at the other end of the arc. Added in version 1049'

java -jar mkgmap.jar --route --remove-short-arcs data.osm

--adjust-turn-headings 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

--ignore-maxspeeds Causes maxspeed tags to be ignored. Added in version r1039
Set this option, if you want to define your own road_speed in your stylefile.

java -jar mkgmap.jar --ignore-maxspeeds data.osm

--make-cycleways Synthesises a cycleway when a road has a cycleway=[lane|track|both|left|right] tag. All tag values have the same effect (the cycleway shares the road's points). Also, bicycles are barred from the road unless it already has a bicycle=* tag.

java -jar mkgmap.jar --make-cycleways data.osm

--make-all-cycleways Enables all cycleway synthesising options.

java -jar mkgmap.jar --make-all-cycleways 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] 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 生成された地図で使われているブロックサイズを変更する。あなたが変更したいと思うことはないと思われる。

--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. To create contour lines directly from an SRTM (or CGIAR, ASTER) file:

--contours If set, create contours.

--dem-type=value Valid values are CGIAR (CGIAR geotiff), ASTER (ASTER geotiff) or SRTM (.hgt files). Default is CGIAR.

--dem-path Path to the DEM data files. The default is type-dependant.

--dem-increment Vertical distance between the contour lines (default is 10m).

--dem-separate-img

テストマップ

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

トラブルシューティング

Option order

If some commands do not work, try to put them before the data file, so enter

java -jar mkgmap.jar [options] data.osm

instead of

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.

Assertions

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 europe-boundaries.o5m.

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 europe-boundaries.osm.pbf.

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 europe-boundaries.o5m or europe-boundaries.osm.pbf. <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>

Parameters:

  • 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: