Understanding mkgmap syntax - Sort German roads


I want to create a map for my garmin unit where I can distinguish for road types in Germany:

  • Autobahn
  • Bundesstrasse
  • Landstrasse / Staatsstrasse
  • Kreisstrasse
  • Everything else

I am using an empty style. It works on some roads, but on some roads it doesn’t. For instance, a tertiary road with the ref K3 is in my map with the correct color. But a secundary road with the ref L403 is completely missing.


# First: All Autobahnen. This works
highway=motorway & ref ~ '[aA][ ]?[0-9]{1,3}' { name '${ref}' } [0x01 road_class=4 level 4]
highway=motorway_link { name '${ref}' } [0x01 road_class=4 level 4]

# Second: Create a pool of all kinds of highways and give them the mkgmap tag "strasse"
highway=primary|highway=primary_link|highway=secundary|highway=secundary_link|highway=tertiary|highway=tertiary_link|highway=unclassified|highway=residential|highway=road {set mkgmap:strasse='yes'}

# Look for all Bundesstrassen, starting with B, assign 0x02
mkgmap:strasse=yes & ref ~ '[bB][ ]?[0-9]{1,3}' { name '${ref}' } [0x02 road_class=4 level 5]

# Look for all Landesstrassen or Staatsstrassen, Starting with ST L etc, assign 0x03
mkgmap:strasse=yes & ref ~ '(St|ST|sT|st|l|L|S|s)[ ]?[0-9]{1,4}' { name '${ref}' } [0x03 road_class=4 level 4]

# Look for all Kreisstrassen, starting with K, assin 0x04
mkgmap:strasse=yes & ref ~ '(k|K)[ ]?[0-9]{1,4}' { name '${ref}' } [0x04 road_class=4 level 4]

# Give all remaining streets the 0x05
mkgmap:strasse=yes {name '${name}'} [0x05 road_class=4 level 2]

Your spelling of “secundary” is what is causing the problem. There may be other errors but highway=secundary will not find anything to tag using OSM data. Try highway=secondary instead.


Hi Dave,

Of course… smiley bonk table I have missed this. I changed it and now the street appears.