OSM Tools
dutch german en francais spanish spanish polish russian

Road shields and routes

How can I fit more than 2 route refs into a shield?

 

 

If the length of the ref is bigger than 8 then Garmin will not show the ref within a shield.

For Oregons the max length is 5!

 

before

after

 

So Evw/Tcw/Orw is shown separately as text.

 

It is most unlikely that  more than 3 routes share the same highway .For this purpose we limit ourselves to a maximum of 3 routes.

 

With three routes you need two separators (/) ,so the maximum length for all refs is 6.

 

This means that you can play it safe by only taking the first 2 letters of each ref chunk.

 

 

1) check if a third ref chunk exists

2) if it does, then reduce each ref chunk to 2 letters

3) finally recreate the ref.

 

in relations, the totref (ie total refs)  gets created for each highway

ie

 

(route=foot | route=hiking)

      {

            apply {          

                    set ref='${ref}';

set oref='$(oref)/${ref}' | '${ref}';                      

      }

      }    

 

In lines we add the following - the code has not been maximised

 

oref=*  {add  part1='${oref|part:"/:1"}'}

oref=*  {add  part2='${oref|part:"/:2"}'}

oref=*  {add  part3='${oref|part:"/:3"}'}

# make them only 2 letters

 part1=* &  part3=* {set part1='${part1 | substring:"0:2"}'}

 part1=* &  part3=* {set part2='${part2 | substring:"0:2"}'}

  part1=* &  part3=* {set part3='${part3 | substring:"0:2"}'}

# now  put the parts together

 oref=* & part3=*{set oref='$(part1)\$(part2)\$(part3) '  }

 

 


What if 2 routes have 4 letters each?

 

Supposing two route each with a 4 letter ref share the same highway?

 

Unfortunately there is no len() function to determine the length of a ref so we have to check if there is a 4th letter:

 

part1=* {set p14='${part1|substring:3:4}'}

 part2=* {set p24='${part2|substring:3:4}'}

 

also we need a variable which is set only if there are two routes only (ie p2='two_only')

 

p2='two_only' & p14=* & p24=* {

    set part1='${part1 | substring:"0:3"}' ;

    set part2='${part2 | substring:"0:3"}' ;

 set oref='$(part1)\$(part2)' ;

   }