tracestrack-maps
tracestrack-maps copied to clipboard
Do not use "ref" to determine road class / shield in Germany (Tracestack-Topo style)
Hi, I noticed a funny bug in this area: https://www.openstreetmap.org/#map=13/48.38915/10.90676&layers=P
There are a lot of blue "Autobahn" shields visible, but only the "8" is actually a motorway. The bug seems to be that any ref that starts with an "A" will produce a blue shield. But while all the "Autobahns" will have a ref starting with "A", there are many other roads which may have an "A" as the first letter in the ref. The city in the screenshot is Augsburg. Tertiary/secondary roads which are maintained by the Augsburg regional council will get a ref like "A 15" or "A 11", which shows in the screenshot as a shield just like the motorway "A 8". The "s 1" label comes from "ref=As 1", which is also not a motorway. If you scroll to the north, there are blue shields like "IC 9", where again a leading "A" in "AIC 9" was dropped.
The same happens around Bamberg: https://www.openstreetmap.org/#map=13/49.88606/10.88994&layers=P
In this area refs start with "BA" and "BA s" - those are local roads and not federal "Bundesstraßen" and should not get the yellow shield. Only the "22" and "505" in that screenshot are federal "Bundesstraßen".
If you can, the best way to get the right shields for German Autobahn and Bundesstraße would probably be to look at their relations, where network=BAB
stands for Autobahn, and DE:national
should be used for Bundesstraße.
You can also look at the road classification to determine what shield you use. All Autobahns should be highway=motorway
and their refs will start with A
(single letter A and a space before some digits; regex ^A\s\d{1,3}
should work).
You can use the blue shield on all the motorways, and should be fine with dropping the A
from the ref.
It's not as simple with the "Bundesstraßen". Most will be highway=trunk
or highway=primary
. Their ref should always start with B
(again, only with the space). Some Bundesstraßen are also mapped as "secondary", e.g. when they go through a town and are less important.
Unfortunately there are trunk, primary and secondary roads in the OSM data that are not federal roads and thus should not have a yellow shield. I did some Overpass research, and it looks like only Bundesstraßen will have a ref that starts with a single B
(B and space) -- but of course I may have missed some exceptions...
Still, I think you can be reasonably sure to use the yellow shield on all trunk roads, primaries and secondaries, if their ref also looks like the regex ^B\s\d{1,4}
. Note that there are a few Bundesstraßen with a letter after the number.
Thanks for maintaining this beautiful style!