[mkgmap-dev] How to display U. S. highway shields with numbers only
From Mark Bradley ethnicfoodisgreat at gmail.com on Sun Jan 4 05:33:42 GMT 2015
Gerd, Thanks for the followup. Somehow I overlooked the Substitution filter that you suggest, which seems like a good idea. It looks like your idea also involves an Oracle Regex expression, with which I am not familiar. I thought about that, but the URL in the Conversion Style Manual for the Regex documentation is no longer correct. (Can someone on this mailing list see that it is corrected?) After a little searching on the Java website, I did not find the documentation, and did not want to take a lot of time looking, so I tried a different tack. After much thought, I came up with a series of commands that seems to produce the desired output. However, it looks like the idea of using the Substitution filter might produce a more elegant solution. I will probably look into that. Anyway, here is the sequence of commands I came up with that seemed to work. (I live in Indiana.) I have only included the commands that pertain to U. S. and state highways. The motorways (interstates) were more straightforward and a lot easier, because their ref values are much more consistent. The problem I had to overcome with the other highways is that the number of characters in the ref key value can vary, from none, to one or more. # Append extra characters to the end of the ref value to ensure it is more than one character in length, otherwise an error will be returned by the Substring filter later. # ("AB" are dummy characters.) highway = * & ref = * { set ref = '$(ref) AB' } # Create the letter_ref key that will determine later what type of symbol to display on the highway. highway = * & ref = * { set letter_ref = '$(ref|substring:0:2)' } # Extract the numbers only from the ref value, which will become the numbers inside the symbols. highway = * & ref = * { set number_ref = '$(ref|part:" :-2)' } #If the highway is a U. S. highway, use a shield symbol. letter_ref = 'US' {name '${number_ref|highway-symbol:shield:3} ${name}' | '${number_ref|highway-symbol:shield:3}' | '${name}'; addlabel '${name} (${ref})' } # If the highway is a state highway, use a round symbol. letter_ref = 'SR' | letter_ref = 'IN' {name '${number_ref|highway-symbol:round:3} ${name}' | '${number_ref|highway-symbol:round:3}' | '${name}'; addlabel '${name} (${ref})' } _____________________________________________ 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20150104/1726017b/attachment.html>
- Previous message: [mkgmap-dev] africa map try 2
- Next message: [mkgmap-dev] How to display U. S. highway shields with numbers only
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list