
Am 22.11.2012 16:05, schrieb WanMil:
Do we have a style-function for this?
item( ${destination}, 1 ) -> Bonn item( ${destination}, 2 ) -> Rodenkirchen
No we don't and it will not be so easy to implement that because the functions do not have any parameters yet at the moment. So it's a big change.
But the style system has a regular expression substitution: ${destination|subst:;=> } So everything behind subst: (in this case ";") is replaced with the string after the => (in this case " "). Maybe the ; must be escaped but generally it should work.
Hi, I'm now using these rules:
# Set the routing direction highway=motorway & ref=* & destination=* { add display_name = '${ref|subst: =>}(${destination|subst:;=> |subst:/=> })' }
highway=trunk & ref=* & destination=* { add display_name = '${ref|subst: =>}(${destination|subst:;=> |subst:/=> })' }
So chars '/' and ';' are replaced by space. Also I shorten the ref (A 1 -> A1) to save one character.
Now, more than one destination city is displayed on my Nuvi Navi.
Note that I removed the motorway_link and trunk_link. They have no highway-symbol-shield and so display_name is not working for them.
Chris
Hi Chris, thanks for the hints. I think I will use that in the mkgmap default style too. Anyhow I am wondering about the exact meaning of the tag display_name. It's not documented and I found only a short piece of code (StyledConverter.java) handling that: String refs = combineRefs(element); // Insert display_name as first ref. // This causes display_name to be displayed in routing // directions, instead of only the ref. String displayName = Label.squashSpaces(element.getTag("display_name")); if (displayName != null) { // substitute '/' for ';' in display_name to avoid it // getting split below displayName = displayName.replace(";","/"); if (refs == null) refs = displayName; else refs = displayName + ";" + refs; } The tag is not documented in the OSM wiki. Throughout europe it is used only 26 times, so I would not call it an official tag. So in mkgmap it should be named mkgmap:display_name instead to document that it is an internal tag. Additionally it can be removed from the builtin-tag-list. If noone opposes I will change that starting with introducing mkgmap:display_name (is there a better name?) but accepting display_name too (giving a warning on stderr). After a while display_name can be removed completely. WanMil