logo separator

[mkgmap-dev] How to display highway shields with numbers only

From Mark Bradley ethnicfoodisgreat at gmail.com on Sat Jan 3 03:25:54 GMT 2015

Thanks for responding Gerd.  Yes, I experimented with the Substring filter,
just as you suggested.  But because the number of characters in the ref tag
varies, I could not figure out how to make it work for all cases.  I'll keep
working on it.

Mark

________________________________________


Hi Mark,

this simple change in default/lines seems to work for me (in MapSource): 

ref=* {set my_ref='${ref | substring:2}''}
highway=motorway { name '${my_ref|highway-symbol:hbox} ${name}' |
'${my_ref|highway-symbol:hbox}' | '${name}' }

Without it I see "A1", with it I see just "1" in the shield.
There is more to do catch all cases for different types of highways and
those without a ref.

Gerd
________________________________________
From: ethnicfoodisgreat at gmail.com
To: mkgmap-dev at lists.mkgmap.org.uk
Date: Thu, 1 Jan 2015 08:49:01 -0500
Subject: [mkgmap-dev] How to display highway shields with numbers only
Hi list members,
 
A few weeks ago I proposed the following problem.  I did not receive any
help, so I will ask again, in case any of you can shed some light.
 
Table 4.4 in the Conversion Style Manual shows highway shields displaying
numbers only, which is what I would like to achieve.  In Table 4.3 (the list
of substitution filters), the description for the highway-symbol filter says
that the filer "Prepares the value as a highway reference such as 'A21'
'I-80' and so on.  A code is added to the front of the string so that a
highway shield is displayed, spaces are removed and the text is truncated so
as not to overflow the symbol."  The description does not explain (from what
I can tell) how to remove the alphabetic characters, leaving only the
numbers.  I've tried several possibilities of the filter without success.
Where I live, there's a motorway called Interstate 70 which is labeled "I70"
in OSM.  I would like to create shields with only the number in the shields,
similar to the example in Table 4.4.  How do I do this?
 
To add a little more information:  The description in Table 4.4 for each of
the first three symbols says "digits only."  If I apply the substitution
filter to the ref values as is, the symbols on the resulting map do NOT
contain digits only, they also include the alpha characters in front of the
numbers that describe what type of highway the highway is, such as "I" for
interstate or "SR" for state road.  Based on this, I have to conclude that
it is up to the mapper to strip off these alpha characters first, before
applying the highway symbol filter.  Again, I have tried numerous
combinations of the style filters and commands without success.  The problem
is that the number of alpha characters preceding the digits can vary.
Sometimes there are no alpha characters at all.  I know how to add "dummy"
spaces to the ref tag for those features that don't have a ref value at all,
but how to strip the alpha characters when the number of characters can
vary, and the separator character is a space?
 
I would've thought this would be a common desire for users in the U. S. and
that it would've been solved a long time ago.  Maybe not?
 
Mark




More information about the mkgmap-dev mailing list