该项目的目标是在我的Garmin Legend Cx上顯示OpenStreetMap数据，以便在制图时了解那些已经完成和那些还未完成。另外，可以看到自己创建的地图是非常开心的。
- 1 下载
- 2 生成地图
- 3 安装
- 4 已知问题
- 4.1 地址搜索
- 4.2 没有基础地图
- 4.3 Routing over tile boundaries broken in Mapsource/Basecamp
- 4.4 Sea polygons
- 4.5 POIs
- 4.6 Area too large
- 5 开发
- 6 Licence
- 7 图形界面
- 8 脚本
- 9 帮助
- 10 链接
- Routing over several (more than 2) tiles in Mapsource
- Address index still not 100% correct (works in Mapsource, in the active tile only on "old-style" GPS like etrex/60CSx/edge, does not work at all on GPS like Nuvi, Oregon)
- Overview map for Mapsource empty (a non empty overview map would pan around quicker)
- Shields are displayed on highways
- Extended/Marine types added, providing more line types
- make-cycleways to synthesise cycle ways on roads that have a separate cycle lane
- Many bug fixes and routing improvements
- 每日更新: mkgmap-latest.tar.gz (最近的, 一般可用，但可能存在问题)
- 每日快照和源程序 Snapshots
- 发行版1625: Zip文件 mkgmap-r1625.zip, tar文件 mkgmap-r1625.tar.gz
- 发行版1188: Zip文件mkgmap-r1188.zip, tar文件mkgmap-r1188.tar.gz ( 前一稳定板 )
It requires Java 1.6, with the last release that worked on 1.5 being r1195. If your operating system does not already have java then install it.
Since at least Jaunty mkgmap is available in the Ubuntu software repositories. Simply run the following at a command prompt to install. note that currently (April 2010) the version in the ubuntu-repository is very old, so you better use the current version from svn sudo aptitude install mkgmap
The program can then be run by typing mkgmap at the terminal.
- Create a file containing OSM data. I do this by saving from JOSM. You can call the file anything you like — I'm using data.osm in the example. You can also get a larger map area by using XAPI like this (example for the UK Midlands area):
wget http://www.informationfreeway.org/api/0.6/*[bbox=-3.5,51.5,-1.0,53.5] -O data.osm
curl -L "http://www.informationfreeway.org/api/0.6/map?bbox=-3.5,51.5,-1.0,53.5" -o data.osm
- Then to make a Garmin map image file; open a command prompt and navigate to your Mkgmap directory. Then run the following command:
java -jar mkgmap.jar [options] data.osm
- This will produce a file called 63240001.img
It's possible that the application may crash out after a point, particularly if you're processing a large area, with Exception in thread "main" java.lang.OutOfMemoryError: Java heap space errors. If this happens, simply increase the size of your max heap space like this:
java -Xmx512M -jar mkgmap.jar [options] data.osm
which would allocate 512Mb of physical memory to the process.
For larger maps, you may want to alter some details of the default map. There are options you can set. If you want to set several options, it might be easier to put the options into a file and use the the -c option. For a complete list see the complete option list (which may be outdated) or run java -jar mkgmap.jar.
Usage: mkgmap [options...] <file.osm> Options:
Print help on the given topic. If the topic is omitted, a list of all the help topics is printed instead.
- -c filename
Specify a configuration file instead of command-line options. In the file, each line is an option setting of the form option=value, just like on the command line except that there is no leading ';--'.
- -n name
Change the name of the map. Garmin maps are named by 8 digit numbers. The default is 63240001. 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.
NOTE: enter just the name, without the ".img" extension, otherwise the tool will throw an exception. The tool won't warn you if you put in something other than 8 digits but your Garmin may not show the map.
Sets the descriptive text for the map. This may be displayed in QLandkarte, MapSource on on a GPS etc.
Sets the map's country name. The default is "UNITED KINGDOM".
Sets the map's abbreviated country name. The default is "GBR".
Sets the map's region name. By default, the map has no region name.
Sets the map's abbreviated region name. By default, the map has no abbreviated region name.
This option allows the use of non-ascii characters in street names. What is actually supported is hardware-dependent. Some devices can only do 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.
Use the specified character set.
Use the given code page.For example, use --code-page=936 to display the correct chinese character.
Allow labels to contain lower-case letters. Note that this doesn't work on many (most, all?) Garmin devices.
Also see the custom style documentation.
Specify a different style name, rather than the default.
Specify an external file from which to obtain the style. "file" can be a directory containing style directories (such as mkgmap/resources/styles) 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 the style that is used.
For backward compatibility, you can also supply a map-features.csv file here. See the customization help.
List the available styles.
- --levels=levels code
Change the way that the levels on the map correspond to the zoom levels in the device. See customization help. The default is the equivalent of "0=24, 1=22, 2=21, 3=19, 4=18, 5=16", although this may change.
Specify the tag that will be used to supply the name. Useful for language variations. You can supply a list and the first one found will be used (e.g. ;--name-tag-list=name:en,int_name,name)
Outdated option. Use the ;--style-file option instead.
Product description options:
This is an integer that identifies a family of products.
This is an integer that identifies a product within a family. It is often just 1.
Changes the block size that is used in the generated map. There is no general reason why you would want to do this.
Create output file that supports "lock to road" option.
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. When making maps to join give each a unique 8 digit name with the flag --mapname. java -jar mkgmap.jar --gmapsupp corsica.img cyprus.img mallorca.img malta.img tenerife.img
When reading OSM files, ignore any "bounds" elements.
Generate a POI for each named road. By default, the POIs' Garmin type code is 0x640a. If desired, a different type code can be specified with this option.
Write a .tdb file.
Write MDR and MDX index files.
Write a .nsi file for use with NSIS to generate an executable to install the map in MapSource on Windows.
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.
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.
Output program version.
- Load this onto your Garmin GPS device. Garmin models such as the Legend Cx can be set into USB mass storage mode, where they appear as just another drive letter (on Windows) or filesystem (on Unix/Linux type systems). In this case you can just copy the map to the file Garmin/gmapsupp.img. Create the folder Garmin if it does not already exist.
- User:Tms13: If your GPS uses removable memory cards, it may be quicker to remove the card and write to it in a card reader - most Garmin units are USB 1.1; a USB 2.0 card reader will write at least 5 times faster, in my experience.
- If you have an older serial connecting and map displaying Garmin device you can upload the .img file to your Garmin unit using Sendmap.
- You can also combine two or more maps to one map with Sendmap or gmaptool.
- The QLandkarte program can be used to upload to the GPSmap 60CSx and the latest version also works to my Legend Cx.
This is a list of currently known problems with mkgmap.
Due to limitations in understanding of the Garmin file formats, we do not know how to make the map searchable for street names using the built-in Garmin street search. Hacks like making every street a POI have been created (see talk page).
An address search in Mapsource only partly works:
- City search appears to works fine
- Feature search appears to work fine as long as you enter a name for the feature
- Address search works, but often cities are mismatched.
- Intersection search does not work
Address search works inconsistently, depending on GPS unit. Some units require you to enter a Province but nothing that is entered works. Others (GPSMap 76csx...) semi-work as long as you enter a fictitious housenumber.
Work is needed to create a basemap, which will speed up map redraw when zoomed far out inside when using Basecamp/Mapsource/Qlandkarte GT. This will allow for more sensible resolutions.
Routing over tile boundaries broken in Mapsource/Basecamp
Routing inside Mapsource/Basecamp (though not on GPS) works inconsistently when the route crosses (several) tile boundaries.
The --generate-sea option can be used to generate the sea polygons but is currently to be considered as "beta". There are two alternative ways of using --generate-sea: either with multipolygons (--generate-sea:multipolygon) or without multipolygons (--generate-sea:no-mp) combined with a TYP file.
No land polygon when --generate-sea:multipolygon is used
The no-mp version of --generate-sea will create a land polygon inside coastline, overwriting the default "Garmin yellow" with a land colour defined in a TYP file. However, the multipolygon version does not create a land polygon, meaning that maps created with this option will use the default Garmin yellow background for land cover.
Suggested solution: re-use the "generate land polygon" code from the --generate-sea:no-mp algorithms and add an option to create a land polygon when using the no-mp version of --generate-sea
No coastline when --generate-sea:no-mp is used
When --generate-sea:no-mp is used, the coastline way is lost.
Suggested solution: add further option to --generate-sea:no-mp that retains the coastline way
Too many POIs for a given area that has been split using multipolygon code
The --add-pois-to-area switch will create an appropriate POI for any polygon that has a definition in the style file. However, the processing of the --add-pois-to-area code happens after the multipolygon split. This means that any multipolygon that is split into distinct polygons by the multipolygon code ends up with multiple POIs when it should only really have one.
Suggested solution: process --add-pois-to-area before the multipolygon code
POIs created outside of polygon
When the --add-pois-to-area switch is applied to complex polygons (e.g. with strongly concave edges, such as beaches) the POI can be placed outside of the polygon with which it is associated. The calculation of what is "inside" a polygon is computationally complex, hence why no solution has yet been implemented.
Area too large
If you try to process an OSM file that is too large, mkgmap will error out due to memory limitations.
To resolve this, you will need to split the file into smaller files using splitter. Here is how to do it:
java -Xmx1000m -jar splitter.jar file.osm
- Run mkgmap on the resulting files, for instance
java -Xmx1000m -jar mkgmap.jar -c template.args
See here for more details (you will most likely need to change splitter's --max-nodes switch to a lower value than the default).
维基页面 development, 主要基于OSM的使用
The software is licensed under the GPL version 2. The maps it produces are to be licensed according to the data they were derived from which is Creative Commons CC-BY-SA 2.0 for OSM data. There is therefore no licensing conflict that might exist with other approaches.
There are currently at least four efforts to provide a GUI for mkgmap, so that users can click on controls rather than remember command line instructions:
- OSM Composer - a GUI built on top of mkgmap, for simplifying the process of creating Garmin map images from OSM and SRTM data.
- MkgmapGUI from freegeographytools - Windows-only, closed source, only provides access to osm->img conversion
- Mkgmapgui from activityworkshop - Java, open source, provides basic access to conversion and img file combination functions
- DoMyMaps - according to User:Lao this has been recently suspended
If you need help then try the following:
- Ask a question in the mailing list. The mailing list can be accessed using any newsgroup reader (eg. Thunderbird) using the following:
- Server: news.gmane.org
- Group name: gmane.comp.gis.openstreetmap.mkgmap.devel
- There is also an archive of the mailing list.
The mailing list is very active and will usually produce the fastest response.
- http://www.parabola.me.uk/mkgmap/ - Download and news
- mkgmap/dev - Page for mkgmap development
- mkgmap/routing - generating routable maps
- OSM Map On Garmin - General overview for creating maps for Garmin.
- OSM_Map_On_Garmin/POI_Types - List of different POI types and how they look on different devices
- OSM Map On Garmin/Download - Download img files created from OSM data.
- Image:Putney-on-gps.jpg - A map of Putney on a Venture Cx, created by User:Gravitystorm
- Image:Qlandkarte sueddeutschland.png - A map of Southern Germany viewed with QLandkarte
- mkgmap/i18n - The internationalization page.
- User:Computerteddy - The World ready to use with Garmin GPS, made with mkgmap from (mostly in German Language)
- OSM Map On Garmin/Cycle map - Making a cycle map with mkgmap.