- Prerequisites:
- Splitting the Map:
- Here is a quick overview about frequently usedswitches, put them behind splitter.jar on the command:
- Compiling the Map:
- Switches that you might need to adjust:
- Some other useful switches for mkgmap
- Read up on the Switches:
- Installing the Map:
- Additional Resources:
- Comments (25)
This is supposed a quick introduction on how to render your own maps using openmtbmap.org style.
This page only exists in English, because you will likely not succeed if you don't understand English. Diese Seite exisitert nur auf Englisch, da man ohne Englischkenntnisse es kaum schaffen wird, sehr viel weiterfuehrende Dokumentation ist nur auf Englisch verfuegbar.
Prerequisites:
a) Install Java JRE 1.6 or later (1.7 or later recommended).
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: http://www.mkgmap.org.uk/snapshots/mkgmap-latest.tar.gz
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:
http://openmtbmap.x-nation.de/maps/openmtbmap_style.zip – Please note that if you distribute maps based on Openmtbmap.org style-file, you must give attribution to Openmtbmap.org. The style-file may only be used for non-commercial purposes.
And put it into the same folder as mkgmap.jar; splitter.jar and the osm.country.bz2 map extract. The style is updated on each general map update (so usually on Thursday evening). The archive is lzma packed, you need 7zip (p7zip on linux) to unzip it.
Alternatively you can download the style with Subversion – this way you're on bleeding edge style: https://svn.origo.ethz.ch/openmtbmap/
Please note, the .TYP-files are in .prj format, and have to be compiled with maptk. The typ1bike1.TYP is for the VeloMap, and not compatible with the Openmtbmaps. If you cannot use maptk, then you can get readily compiled TYP-Files by downloading a map (map legend is the smallest download). Don't forget to adjust the FID/PID, otherwise it won't be used on you GPS. The bikingmap directory is home of the VeloMap.org maps style-file.
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 --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
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%" --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 http://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.
Additional Resources:
Openstreetmap Mailinglist archives: http://n2.nabble.com/OpenStreetMap-f660402.html
Openstreetmap Forum: http://forum.openstreetmap.org/index.php
Das TYP-File scheint tatsächlich zu fehlen. Wenn ich die Karten per mapsetk installiere klappt alles. Aber wenn ich versuche eine gmapsupp.img mit einem TYP-File zu erzeugen (wie von dir unter Send Maps to GPS with mkgmap) schlägt das irgendwie fehl. Auch die Erzeigung von passenden NSIS-Installer klappt nicht. Aber das scheint an der Version zu liegen. Kann es sein, dass du eine NSIS-Version <=2.3 verwendest?
Ja ich verwende eine hohe Version und hab noch zig Patches drinnen.
Hy Felix,
da die Karten grad nicht erreichbar sind überlege ich mir auch sie selber zu rendern. Bevor ich mich nun in die Sache mit dem Patch reinarbeite kurz die Frage: was für Nachteile habe ich, wenn ich Deinen Patch bei mkgmap nicht verwende ?
Danke !
Tobias
Les dir den Patch einfach durch. Da sind die Änderungen beschrieben.
Ich habe mal versucht die Karte für NRW mit dem Style aus dem SVN zu bauen (nachdem das ZIP-Archiv ja nicht mehr erreichbar ist). Aber irgendwie sieht die Karte merkwürdig aus. Ich bin dieser Anleitung recht strikt gefolgt, außer, dass ich die Befehle für Linux umgesetzt habe und durch meine CI (Jenkins) ausführen lasse. Es wird zwar eine Karte gerendert, die auch MapSource und auf meinem etrex angezeigt wird, aber sieht ganz anders (eigentlich unlesbar) aus.
Muss ich vielleicht eine spezielle Revision auschecken (habe einfach HEAD ausgecheckt)?
Nein, evtl das Typfile vergessen?
Hallo,
habe zur velomap.TYP viele deutsche Übersetzungen hinzugefügt. Vielleicht nützlich für Dich. Wie kann ich sie Dir schicken? Habe keinen SVN account und keine email Adresse von Dir gefunden.
Dank für deine velomap!
- Michael
========================================
Hmm, kannst mir zuschicken .. extremecarver …. gmail.com
Bin mir aber nicht sicher ob es sich wirklich lohnt die reinzutun – da ich ja kaum Objekte ohne Namen hab, und die Namen im TYPfile nur benutzt werden, wenn kein Name vorhanden ist.
Der Bau der Karten hat super funktioniert
Bei mkgmap gibt es die Option –suppress-dead-end-nodes nicht. Kommt dieser Parameter durch die gepatchte mkgmap?
In deinem Style Packet fehlt die Datei deletetags. Zumindest verwendest du diese in der Comand Line. Was hat es damit auf sich?
Wenn ich in meiner gebauten Karte ein Route berechne und sie in einer openmtb karte neu berechnen lasse, kommt eine etwas andere Routenführung heraus? Könne das an den oben genannten Punkten liegen????
Gruss und danke
–suppress-dead-end-nodes gibt es nicht mehr. Kam mal von einem Patch. deletetags funktioniert nicht mehr – daher fehlt inzwischen auch die deletetags DAtei. Hab die Optionen mal aktualisiert. Routenführung liegt eher an anderer Kachelaufteilung oder dass die Daten von einem anderen Tag sind – schon kleine Änderungen können viel ausmachen….
die optionen hab ich verstanden
Routenführung: ich habe auch bei deinen karten bemerkt, dass sich das routing mal verändert, habe das aber auf veränderungen in deiner Config zurückgeführt.
ist die aufteilung der kacheln ein zufallsprodukt oder würde die aufteilung bei gleicher osm datei immer identisch sein bei mehreren Durchläufen
ich habe die routing vergleiche in münchen gemacht. der Datenbestand ist hier relativ stabil, daher glaube ich es liegt an der Aufteilung der kacheln. Ich habe auch die openmtb Germany mit der von mir erzeugten Bayern verglichen (wollt Rechenzeit sparen) und da ist die Aufteilung bestimmt anders.
der Splitter unterstützt derzeit noch nicht das pbf format. ich wollte mal was von amerika ausprobieren. mal schauen ob ichs konvertieren kann.
deine style files annähernd zu verstehen werd ich mir für schlechtes wetter vornehmen
danke für alle deine mühe
vielleicht geht die Konvertierung mit osmosis
das schau ich mir aber mal ein anderes mal an
warum verwendest du eigentlich splitter und nicht osmsis
auch bei den openmtbmaps weicht das routing ab je nachdem ob ich auf der germany oder der bayern bin. deine vermutung war also richtig.
das wars jetzt aber
Osmosis ist nicht für mehrere Kacheln geieignet und saulangsam.
Vielleicht kannst du ja noch die Option –geonames-file beim Splitter aufnehmen
Ob es jetzt sinnvoll ist oder nicht, ich habe den ganzen Ablauf auf ganz Europa losgelassen. Splitter hat ca 10 Stunden gebraucht und mkgmap nochmals 9.
Warum splittest du mit –max-nodes=600000 ich habe es mal mit –max-nodes=1400000 probiert und der nachfolgende mkgmap war erfolgreich. Auch auf dem Navi ging die karte.
Irgendwo habe ich mal gelesen, dass max-nodes idealerweise so hoch wie möglich sein soll, am besten so hoch, dass die SplittFiles gerade noch von mkgmap bearbeitet werden können.
Ich splitte je nach Land mit unterschiedlichen Werten. Für ganz Europa braucht es aber 600.000 – daher steht es oben so. Sonst fehlen ab und zu Kacheln. –geonames-file=cities15000 benutze ich eh, aber oben dazuschreiben finde ich sinnlos, das geht zu tief ins Detail bzw braucht weitere Erklärungen. Obige Anleitung covered eh nur die essentiellen Basics.
Hi,
I keep on getting errors such as :
SEVERE (Main): java.util.concurrent.ExecutionException: uk.me.parabola.imgfmt.ExitException: Could not open style null
java.util.concurrent.ExecutionException: uk.me.parabola.imgfmt.ExitException: Could not open style null
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:289)
at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:123)
at uk.me.parabola.mkgmap.main.Main.main(Main.java:100)
Caused by: uk.me.parabola.imgfmt.ExitException: Could not open style null
at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.createStyler(Osm5MapDataSource.java:126)
at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:79)
at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:148)
at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:56)
at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:168)
at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
java -ea -Xmx1024M -jar /usr/share/mkgmap/mkgmap.jar –style-file=/home/samokk/osm/styles/openmtbmap_style –max-jobs –generate-sea=polygons,extend-sea-sectors,close-gaps=6000 –reduce-point-density=5.4 –suppress-dead-end-nodes –index –transparent –adjust-turn-headings –ignore-maxspeeds –ignore-turn-restrictions –remove-short-arcs=4 –description=hike_usa_nh –location-autofill=1 –route –country-abbr=us –country-name=USA–mapname=12340000 –family-id=1234 –product-id=1 –series-name=”hike_usa_nh_%date%” –family-name=”hike_usa_nh_%date%” –tdbfile –overview-mapname=mapset –area-name=”NH_%date%_hike.org” -c template.args –gmapsupp
ls /home/samokk/osm/styles/openmtbmap_style
bikingmap info lines No Contact Information.xls options points readme – copyright.txt thin.typ typ1bike1.typ.prj typ1thin1.typ.prj typ1wide1.typ.prj version
clas.typ legend.osm mkgmap_velo.jar openmtbmap_style.7z.zip overlays polygons relations trad.typ typ1clas1.typ.prj typ1trad1.typ.prj velomap.TYP wide.typ
Also, the deletetags file does not seem to exist. are the instructions still up to date ?
Well you definitely point mkgmap to the wrong location for the style. It cannot be found. Delete-tags is not used anymore by mkgmap. It got corrupted when the new style rendering got introduced. I had to move the rules into the main style – which makes mapbuilding slower by 10-20%.
Hello,
I am wondering why you use “–max-areas=255″ two times in the splitter command line.
Best Regards,
Christian
if it’s two times, it’s a typo. but won’t matter…..
Thanks for the great tutorial.
Just wanted to add a comment about German umlauts, which for some reason did not show up on my Garmin Oregon 550t with the img files on the download server. Adding two additional parameters "–latin1 –lower-case" to the mkgmap.jar script above did the job!
Thanks,
Tom
Anf fuck up the address search. That’s why I’m not using -latin1.
As for lower-case – it is not compatible to all GPS.
Address search never worked on my Oregon 550t before, so I didn't even notice that as a new issue… OTOH, Garmin Mobile XT (5.00.40) so far works pretty well with those additional parameters – no more truncated city/street names or strange special characters (like "D???? S???"). Even address search seems ok.
Anyway, thanks to this tutorial I can create maps the way they work best for me.
This is a great tutorial. Thanks!
I’ve just started experimenting “rolling my own” map and am testing the effect of different mkgmap options.
Looking at the mkgmap commandline used for openmtbmap explains why routing restrictions are overlooked on my eTrex. I find that I am routed incorrectly at restricted road junctions on my journey to/from my favourite offroad areas even after adding restriction relations to OSM.
Is there a reason why you use the –ignore-turn-restriction option when building the maps?
Thanks,
Mezzanine.
If someone comes up with a yyntax for bicycle routing restrictions I’ll use it. Restrictions for motor_vehicles are mostly not useful. Therfore I’m going to ignore them!
In the UK, routing restrictions at road junctions apply to all road users by default; if there’s a turn restriction, it applies to all vehicles (cars, bicycles, psv etc.), not just motor_vehicles. In special cases, there should be an access=designated way which doesn’t have the restriction relation. Perhaps regulations are different in other countries? However, if it’s the same everywhere, it may be more beneficial for cycle users to adhere to routing restrictions than ignore them…