logo separator

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

From GerdP gpetermann_muenchen at hotmail.com on Sat Jan 3 04:11:24 GMT 2015

Hi Mark,

okay, so your problem is not directly related to the highway symbols.
What you need is a simple filter to return the part of a string which
starts at the first digit. I guess this can be done with subst plus a
regular expression,
but I'm not sure how exactly.
Something like
ref=* {set my_ref = ${ref|subst:"[a-zA-Z]*~>"}


Gerd


Mark Bradley-2 wrote
> 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@

> To: 

> mkgmap-dev at .org

> 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
> 
> 
> _______________________________________________
> mkgmap-dev mailing list

> mkgmap-dev at .org

> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev





--
View this message in context: http://gis.19327.n5.nabble.com/How-to-display-highway-shields-with-numbers-only-tp5828816p5828820.html
Sent from the Mkgmap Development mailing list archive at Nabble.com.


More information about the mkgmap-dev mailing list