Questa pagina esiste solo in inglese, perchè è impossibile riuscirci se non si conosce l'Inglese visto che tutta la documentazione disponibile è in inglese.
- 1 Prerequisites:
- 3 Splitting the Map:
- 4 Compiling the Map:
- 5 Installing the Map:
- 6 Additional Resources:
a) Install Java JRE 1.6 or later.
If you have problems doing so, there is a good wiki page here: http://wiki.openstreetmap.org/wiki/Java_Runtime_Environment
b) Download mkgmap latest: mkgamp_latest.zip
You can read up on mkgmap on the mkgmap wiki page: http://wiki.openstreetmap.org/wiki/Mkgmap
The mkgmap Mailing List is subsicrable here: http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Or here as a forum/archive: http://n2.nabble.com/Mkgmap-Development-f4411397.html
Note I'm using a patched mkgmap version, if you want to profit from the patches that have some enhancements, especially for biking, then you can find the patches I'm using inside the SVN. I'm not going to explain how to use the patches, please google if you don't know how to apply a SVN patch.
c) Get mkgmap Splitter from here: http://www.mkgmap.org.uk/splitter/
the helpfile for the splitter on the wiki is not up to date ( http://www.mkgmap.org.uk/page/tile-splitter ), if you want more info on the splitter, run
java -jar splitter.jar --version
d) Get the OSM map data you want to compile
I recommend download osm extracts from Geofabrik: http://download.geofabrik.de/osm/europe/
e) Get the Openmtbmap.org Stylefile:
Please note, I do not offer the style-file anymore. This has several reasons: a) I nearly offer worldwide coverage on maps. b) During the last two years, I got only twice a proposal for change. c) Quite a few people/companies copied stuff from the style-file, without proper attribution.
f) Put mkgmap.jar, splitter.jar and the maps (country.osm.bz2 - don't unextract them) to c:\garmin\mkgmap\ - the openmtbmap.org style has to be extracted and the files placed into c:\garmin\mkgmap\openmtbmap_style\. If you change the folder you simply have to change the commands bellow to fit.
Splitting the Map:
First "split" the maps. This step is needed in order to create the tiles that mkgmap.jar will later compile. Only for very small countries with few OSM data you can avoid this step:
In your console (cmd.exe for Windows) go to the directiory where you put the "prerequisites (on windows you enter i.e. cd c:/garmin/mkgmap/ )
java -Xmx4000m -ea -jar splitter.jar --max-nodes=600000 --overlap=4000 --max-areas=255 --cache="cache" --description="germany" --mapid="12340000" --max-nodes="600000" --no-trim --overlap="4000" --status-freq="600" germany.osm.bz2
Xmx4000m gives 4000 MB of RAM to Java. Adjust it to the maximum of RAM you can attribute without your PC starting to swap heavily (e.g. if you have 6GB of RAM set this to 4000M; if you use 2000M and split europe, you will have to decrease --max-areas). This is a java option.
Here is a quick overview about frequently usedswitches, put them behind splitter.jar on the command:
overlap=4000 - In order for mkgmap to stitch the tiles together there needs to be an overlap. 1000 is default, with 4000 one can avoid some errors.
no-trim - You can use this in order to have the map looking nicer in Mapsource, on the other hand if you combine several mapsets on your GPS and are in a border region then an empty map may overlap another map with information so it has disadvantages too.
description=germany - Put a description here, best use the name of the country/region of the map you're splitting
mapid=12340000 This will determine the file name the splitter uses. I usually set it to the "FID" that I give the maps later and add "0000"
last the map input file. splitter.jar will accept bz2 zipped files, or unzipped .osm
cache=folder (you have to create this subfolder in mkgmap directory) is given to speed up splitting if splitter.jar has to do several passes (e.g. splitting europe).
max-nodes=600000 specify the tile size. if 600000 should be a save value for any European country. If you dare to compile the whole world, you might even resort to 400000
max-areas=255 decrease it if you run out of memory on splitting. Mkgmap will then make more passes. In this case you should set -cache=cache which will create a folder /cache where splitter caches data.
You can read up on the commands by running: java -jar splitter.jar --version
Compiling the Map:
Now that we have splitted the maps, we can compile them with mkgmap:
java -ea -Xmx4000M -jar mkgmap.jar --style-file=c:\garmin\mkgmap\openmtbmap_style --max-jobs --generate-sea=polygons,extend-sea-sectors,close-gaps=6000 --reduce-point-density=5.4 --x-reduce-point-density-polygon=5.4 --index --transparent --adjust-turn-headings --ignore-maxspeeds --ignore-turn-restrictions --remove-short-arcs=4 --description=openmtbmap_de --location-autofill=1 --route --country-abbr=de --country-name=germany --mapname=12340000 --family-id=1234 --product-id=1 --series-name="openmtbmap_de_%date%" --family-name="mtbmap_de_%date%" --x-tdbfile --overview-mapname=mapset --area-name="Germany_%date%_openmtbmap.org" -c template.args
Switches that you might need to adjust:
style-file=folder adjust it to tell mkgmap where the openmtbmap style-file is to be found.
max-jobs if you run out of memory on compiling, you can use --max-jobs=2 to only have 2 processor cores compiling.
index if you set this than an address index is generated (which is needed to search for addresses). Note this address index cannot be included to gmapsupp directly by mkgmap, but has to be exported with Mapsource.
transparent - I set the map transparent an afterwards run gmt.exe -w -n *.img to set the map opaque again. This increases the performance of the map on old GPS as no 0x4b background polygon is set. If you omit running gmt.exe then the maps will show above all other maps when activated on GPS (only valid for streets and POI, polygons are not shown above other maps).
mapname=12340000 Sets the name of the maps output (similar to --mapid for splitter.jar)
family-id=1234 Set the FID for the mapset. Use one that is not used yet (you can check what FIDs are already used by installed maps with Mapset Toolkit)
-c template.args This file was created by the splitter and tells mkgmap how to compile the maps. Alternatively you can exchange this by *.osm.gz
Some other useful switches for mkgmap
--gmapsupp - Write a gmapsupp.img file that can be uploaded to a Garmin or placed in "/Garmin" in a (micro)SD card (such as by mounting the device in USB mass storage mode or putting the memory card into a card reader).
Read up on the Switches:
The most up to date switches can be found by running: java -jar mkgmap.jar
Installing the Map:
Easiest is to copy the whole output (*.img *.tdb *.mdx ) into a new folder, and then use Mapsettoolkit (version 1.75 beta or newer) to register it in Mapsource. You will also need to use a typfile. You can open the .prj files to compile .TYP-files with maptk. Read https://openmtbmap.org/tutorials/install/installation-with-mapsettoolkit/ to see the details on how to do it. If you create a map of Europe or another large map, the index might be broken and prevent mapsource from starting up if registered. If so trash *.mdr.img and *.mdx and reinstall the map. Alternatively you could install nsis, and use nsis to create an installer.
Openstreetmap Mailinglist archives: http://n2.nabble.com/OpenStreetMap-f660402.html
Openstreetmap Forum: http://forum.openstreetmap.org/index.php