- 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 (18)
This is supposed a quick introduction on how to render your own maps using VeloMap.org style. I will not provide further help. You should be computer savy to do it. Mind though, that I didn't update the mkgmap parameter options since a long time, as depending on the country I use quite different options. Check mkgmap docs for your best options.
Prerequisites:
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: 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
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 VeloMap.org Style-file and .TYP-file:
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 VeloMap.org style has to be extracted and the files placed into c:\garmin\mkgmap\velomap_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 --cache="cache" --description="germany" --mapid="12340000" --max-areas="255" --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\VeloMap_style --max-jobs --link-pois-to-ways --generate-sea=polygons,extend-sea-sectors,close-gaps=6000 --reduce-point-density=5.4 --index --transparent --adjust-turn-headings --ignore-maxspeeds --ignore-turn-restrictions --remove-short-arcs=4 --description=VeloMap_de --location-autofill=1 --route --country-abbr=de --country-name=germany --mapname=12340000 --family-id=1234 --product-id=1 --series-name="VeloMap_de_%date%" --family-name="velomap_de_%date%" --overview-mapname=mapset --area-name="Germany_%date%_VeloMap.org" -c template.args
Switches that you might need to adjust:
style-file=folder adjust it to tell mkgmap where the VeloMap 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://velomap.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.
Additional Resources:
Openstreetmap Mailinglist archives: http://n2.nabble.com/OpenStreetMap-f660402.html
Openstreetmap Forum: http://forum.openstreetmap.org/index.php
Hallo extremcarver.
ich versuche mich nun an einer eigenen Karte.
Es geht soweit auch alles. Das einzige, was mir noch fehlt, sind die Radweg relationen.
Ich habe versucht über Parameter beim splitten etwas zu erreichen, aber auch über Parameter (make_all_cyclemap bzw. make_cyclemap) beim Aufruf von mkgmap etwas zu erreichen.
Es kommen aber kaum etwas mit route=bicycle.
hier einmal ein Auszug aus styles:lines
# Radwege Relation erkennen
#———————————
route=bicycle {set a_rw=yes)
icn_ref=* | icn = * | route=icn | type=route & (netwerk = icn | ref = icn ) {set int_radweg=yes }
lcn_ref=* | lcn = * | route=lcn | type=route & (netwerk = lcn | ref = lcn) {set loc_radweg=yes }
ncn_ref=* | rcn = * | ncn=* | route=ncn | route=rcn | type=route & (netwerk = rcn | netwerk = ncn | ref = ncn ) {set nat_radweg=yes}
nat_radweg=yes | loc_radweg=yes | int_radweg=yes {set a_rw=yes}
===
Ich habe jetzt gestern Abend noch gelesen, dass es auch eine “relations” Datein im Style Verzeichnis gibt. Kann es sein, dass die mir fehlt?
Haben Sie einen Tipp für mich?
Viele Dank im Voraus
Rainer
Ich glaube es hat sich erledigt. Mit der relations Datei geht es.
Danke
Rainer
Die bicycle Parameter kannst du getrost vergessen. Die sind veraltet und im Style besser lösbar. Routen musst du von der relations taggen und dann in der lines übernehmen…
Hallo extremecarver,
könnten sie mir verraten, wie man z.B. mehrere Radrouten auf einem Weg in der
relationsdatei angeben muss, damit sie (in lines) kommen?
Ich bekomme immer nur eine relation.
Habe diese Zeile dort eingetragen:
type=route & route=bicycle {
apply {
set type=route;
set route=bicycle;
set rout_ref=’{ref}’;
set ref=’${name} ${network}’;
set network = ‘${network}’;
}
}
Würde auch gerne z.B. über den ref-Wert ein Bild entlang der Route anzeigen.
Das würde man dann wohl über die Poins Tabelle machen.
Haben sie da eventuell auch einen Tipp?
Viele Dank
Rainer
a) geht nicht. Was geht (weiß ich aber nicht ob es derzeit dafür einen Patch braucht und gibt – gab mal von NOP (RRK) einen dafür) wäre die Radrouten direkt aus der Relationsdatei in die Karte zu bringen. Anders gehts nicht, weil da müssten ja dann beim set command, mehrere set route usw gesetzt werden. Was geht ist noch je nach Art der Route, andere Werte in die Lines zu übertragen. Damit bekommt man dann etwa icn und lcn auf selbem Weg beide rüber zur lines. also etwa set route_lcn=.. set ref_icn=…. Das benutze ich, damit immer die wichtigste Route in die Karte kommt – also nicht eine icn oder ncn durch eine lcn überschrieben wird.
b) Es gibt die Funktion points für Linien zu setzen, ich finde das aber sehr sehr wenig praktisch. Vor allem weil ja mindestens pro Segment ein POI gesetzt werden muss. Die Bilder müssten dann im Typfile referenziert werden – und man müsste es jeweils auf die exakte Relation erstellen.
Danke für deine schnelle Antwort.
zu b:
Ich habe mir das nur mal bei anderen Karten angesehen und fand es
sehr Übersichtlich, wenn man beim Routenplanen schon den Radweg durch
ein POI erkennt, dachte es gibt vielleicht eine Funktion, die das macht, wenn man sie richtig versorgt
zu a:
Ich verstehe nicht wie man beide Werte icn und lcn bekommt, was ich z.B. set route_lcn zuweisen soll.
Ich bekomme doch nur ein mal eine Relation pro Wegstück angeboten.
Die beinhaltet in Wesentlichen name, ref, network …
Alle anderen Relationan scheinen ja zu fehlen, sonst könnte ich in Lines darauf reagieren.
Ich kann doch nur route_lcn=network und route_icn=network setzen.
Wie komme ich dann an unterschiedliche Werte ran, oder gibt es in
den Relationen noch mehr Key’s?
Wäre es möglich, dass sie mir ihre lines und Optione ggf. einmal mailen könnten. Ich habe mich schon mehrere Tage durch OSM und das Internet gelesen, aber es gibt da immer nur allgemeine Informationen.
Scheinbar muss man da direkt mit den Entwicklern von mgkmap in Verbindung stehen um die Insiderinfo’s zu bekommen
Vielen Dank
Rainer
zuerst – welche Karte(n) meinst du? Wanderreitkarte von NOP – da finde ich die POI für Routen absolut grausam. Sind hauptsächlich unübersichtlich.
zu a) – in der relations Datei bestimmst du, welche Werte wie zu lines zugewiesen werden – also der Datenbank als line hinzugefügt werden. Wenn du nun anstelle route_ref und route_name usw einfach route_ref_icn und route_ref_ncn und route_ref_lcn usw setzt – sprich unterschiedliche Schlüssel benutzt, je nachdem ob die Route icn, ncn, lcn.. ist, dann überschreiben sich diese nicht, und du kannst sie separat in der lines Datei abfragen. Da hast du dann die Möglichkeit die Werte zusammenzufügen (etwa alle Namen hintereinander) – oder je nach Relation jeweils eine Linie erstellen zu lassen. Wenn allerdings einmal icn, und zwei lcn Routen auf einem Wegstück sind, bekommst du nur icn und eine der beiden lcn. Nicht beide lcn. Das würde nur gehen, indem du direkt in der relations Datei, einen Action Block setzt [0x0? resolution.. road_speed....]
Sorry, mein style-file veröffentliche ich nicht mehr.
Bezüglich mkgmap ist die Dokumentation teils etwas lückenhaft – einiges muss man durch durchlesen der Mailingliste lernen/kennenlernen.
Hallo
Karte: ich habe mir die Karte von J. Formann angesehen.
Er hat die Wegschilder nur bei icn angezeigt.
Es ist nur ein kleines Highlight, aber nichts wirklich wichtiges.
===
Das mit den Routennamen und Ref’s hat geklappt, vielen Dank.
Ich kann jetzt alle Routen auf einem Wegstück (wie bei ihnen) anzeigen.
Die Haupterkenntniss war
set rcn_name=’$(rcn_name), ${name}(${ref})’ ….
das es einen Unterschiend von ..() und ..{} gibt!
Viele Grüße
Rainer
wo gibt es openvelomap style? auf ftp5.gwdg.de/pub/misc/openstreetmap/openmtbmap gibt es ihn nicht,
die beiden server auf origo.ethz.ch lassen keine verbindungen zu.
hintergrund: auf mac os x gibt es keine moeglichkeit, karten zu verbinden (qlandkartegt legt keinen index an, mapsource gibt es nicht fuer os x und funktioniert nicht mit wine), also muss ich mkgmap verwenden um das mapset.img und das tdb-file zu erstellen.
Den Style habe ich offline gestellt. Der Grund dafür ist folgender – primär hatte ich ihn online, damit Leute Patches schreiben können, oder an der Entwicklung mitmachen. Dies ist aber im Prinzip nie passiert. Da ich jedoch recht oft lizenzmäßig nicht erlaubtes Kopieren erlebt habe, habe ich beschlossen den Style nicht mehr zu veröffentlichen.
Ausserdem decke ich inzwischen mehr oder weniger eh die ganze Welt mit Karten ab.
Wenn du nur mapset.img bzw mapset.tdb erstellen willst, dann brauchst du den style nicht. Den brauchst du NUR wenn du aus .osm(.pbf) Daten Karten rendern willst.
Hallo,
habe mal einige Karten gerendert, da ich ein paar rennradspezifische Änderungen im Style vorgenommen habe. In Mapsource ist auch alles super, allerdings bin ich nicht in der Lage die Karten aus Mapsource zu übertragen. Dort bricht das Programm ab mit
Fehlerinformationen:
App: MapSource
At: 30.06.2011 10:18:44 (UTC)
OS: Windows 7
Processor: x86, Processor Level: 6, Processors:2, Model: 23 Stepping: 10, RAM: 3620764
DSK_FILE.CPP-383-6.16.3.0
Karten die ich von velomap oder openmtbmap heruntergeladen haben lassen sich problemlos übertragen.
Ich vermute irgendwelche Problem mit mkgmap. Ich setzte unter Windows Version 1866 ein, unter Linux Release 1973. Bei beiden passiert der gleiche Fehler
Ist euch so etwas bekannt ?
1973 erzeugt kaputte mdr.img Files. Benutze 1970 für funktionierenden Karten derzeit. 1866 hätte passen sollen. Lösche und deregistriere mdx und _mdr.img und sende die Karten. Dann funktioniert es (ohne Adresssuche). Evtl ist auch der Speicher ausgegangen am Windowsrechner beim erzeugen der _mdr.img?
Ansonsten ist für sowas die mkgmap Mailingliste besser.
An den Files hat es nicht gelegen. Ich habe die mal gelöscht & deregistriert, es bricht aber immer noch ab. Ich habe noch mal alle Parameter beim mkgmap aufruf mit Deinen verglichen und das sieht ziemlich identisch aus. Hier vom Linux System und release 1978, da scheinen die mdr Files wieder ok zu sein.
java -ea -Xmx3000m -jar /home/carsten/osm/tools/mkgmap-r1978/mkgmap.jar –style-file=/home/carsten/osm/garmin/styles/roadmap –max-jobs=4 –link-pois-to-ways –generate-sea=polygons,extend-sea-sectors,close-gaps=6000 –reduce-point-density=5.4 –index –transparent –adjust-turn-headings –ignore-maxspeeds –ignore-turn-restrictions –remove-short-arcs=4 –description=”roadbike_hessen_30-06-2011″ –location-autofill=1 –route –country-abbr=de –country-name=Germany –mapname=61010000 –family-id=6101 –product-id=1 –series-name=”roadbike_hessen_30-06-2011″ –family-name=”roadbike_hessen_30-06-2011″ –overview-mapname=mapset –area-name=”hessen” -c template.args
Ich werde mal paralell eine Anfrage auf der Mailinglist starten.
1978 ist aber auch kaputt. 1970 ist die letzte Version die sicher funktioniert!
(ausserdem ist meine Version ja noch gepatched, aber das sollte nichts ändern)
Ok, dann nehme ich die 1970
Bin aber mittlerweile auch hinter den Fehler gekommen. Und zwar sind wohl die Typ-Files die ich verwende defekt. Ich habe jetzt mal eins von dir genommen und mit MapTK die FID angepasst. Dann ging es sofort.
Was verwendest du denn um die FID im Typ-File anzupassen, wenn du deine Karten updatest ? Ich hatte da so ein Perl Script das das macht, damit ich nicht jedes Mal manuell mit MapTK ran muss. Scheint aber nicht so zu funktionieren….
gmt (gmaptool)
Oh, und hab grad noch den SVN Link ausgebessert. Die GIT Branch aktualisieren ich seit gut 4 Monaten nicht mehr…
Ok, letztes Update : das TYP-File darf nicht mehr als 8 Zeichen haben. Dann gehts auch mit meinen eigenen Typ-Files. Danke auf jeden Fall, auch für den gmt Tipp