mkgmap - highway ref name manipulation

Hi!
Maybe someone will help solve my problem…
On my custom map I’ve road shields with it name/number.
For secondary and tertiary I get some OSM internal refs which are useless (no real live use while navigation).
I would like to get rid of them.
Example crossing: https://www.openstreetmap.org/#map=18/52.31347/21.00157
Secondary 633 is OK, tertiary 5580W - not.
Lines code:
highway = secondary & ref! (~ ‘[0-9][0-9][0-9][0-9][A-Z]’) {name ‘${ref|highway-symbol:oval}’} [0x10d04 resolution 18-19 continue]
highway = secondary & ref ~ ‘[0-9][0-9][0-9][0-9][A-Z]’ [0x10d04 resolution 18-19 continue]

To goal is to not show shields for roads with OSM internal refs like 5580W.

Please help.

I am not sure what problem you get with those two rules. Maybe you should add a rule which handles ways without a ref?

Besides that I don’t understand the phrase “OSM internal refs”. OSM doesn’t need any internal refs.

Gerd, please take a look at provided link. At this crossing there is a road with ref 5580W.
This number is useless - there is no road called 5580W in real life so in such condition there no need to display shield with this number.
Rule which I try to appply need to hide shields for such roads.

I dont know your code, but in the default line style the ref shields are processed like this


# Display highway shield for mayor roads if they have a ref and make them searchable by their name
(highway=motorway | highway=trunk) & ref=* {name '${ref|highway-symbol:hbox}'; addlabel '${name}'}
highway=primary & ref=* {name '${ref|highway-symbol:box}'; addlabel '${name}'}
(highway=secondary | highway=tertiary) & ref=* {name '${ref|highway-symbol:oval}'; addlabel '${name}'}

name=* {name '${name}'}
highway=* & ref=* & highway!=motorway & highway!=trunk & highway!=primary & highway!=secondary & highway!=tertiary
    {addlabel '${ref}'}

highway=* & int_ref=* {addlabel '${int_ref}'}
highway=* & nat_ref=* {addlabel '${nat_ref}'}
highway=* & reg_ref=* {addlabel '${reg_ref}'}

So if you dont like to see them, just delete the highway=tertiary from line 4 and 7 right?

BTW if 5580W does not exist in real life, the OSM data should be corrected by editing the map.

In Germany you don’t see refs for tertiary roads on normal road signs but you find them on milestones and they are also used in newspapers in articles about construction work or accidents.

I don’t want to get rid of those road. I just don’t want to display shields for it. So working regex is needed with logic as follow:
If ref length = 5 and 1st char is digit[0-9] and 2nd char is digit[0-9] and 3rd char is digit[0-9] and 4th char is digit[0-9] and 5th char is letter[A-Z] don’t display shield for it.

The rule (highway=secondary | highway=tertiary) & ref=* {name ‘${ref|highway-symbol:oval}’; addlabel ‘${name}’} is only adding a shield. If you remove this line it does not remove the road from your map.

I think

highway = tertiary & ref ~ '[0-9][0-9][0-9][0-9][A-Z]' 

should work, means, it should match for way 188220733.

So, maybe the problem is to find the negation? That would be

highway = tertiary & !(ref ~ '[0-9][0-9][0-9][0-9][A-Z]') 

Thanks Gerd, I will test this rule negation.

Edit…
After some more modifications of lines file I get what I need.
Moreover I dig deeper to find source of road naming and I found that those ref names are OK but I never saw it on road signs or maps.

Regards,
Artur