Style directive not working


I have been using the following rules to process and render milestones for many months. Now, I just noticed they have quit working the way they did.

highway=milestone & ref!=* & distance!=* {set name='M/S'} [0x05a00 resolution 24]
highway=milestone & distance=0 {name 'Km Zero: ${ref}' | 'Km 0'} [0x05a01 resolution 24]
highway=milestone {name '${ref} (${distance})' | 'Rte.${ref}' | '${distance} km' } [0x05a00 resolution 24]

Given a milestone with the tags:


This object would show up on my maps with my custom icon 0x05a00 and the text “106 (146)” to the right of it.

In the case of milestone having a distance=0, and ref=3044 I would see the text

“Km Zero: 3044” near my custom 0x05a01 icon.

Now, I see only the icons and the ref but never any other text. In the case of a milestone with no ref and no distance tags, I do see the M/S so that appears to be working.

I am using a recent release of mkgmap, v.3633, from August 2015

Something has changed but I don’t know what might cause this behavior. I have not changed the rules unless I did so by accident. Furthermore, they appear to be correct syntactically. Anyone have any ideas?

Please check if you use “include ‘inc/name’;” in your style. If this is before your declaration for “highway=milestone” then name could be already set for this point.

Popej, you’ve come to the rescue again. Many thanks. The “include ‘inc/name’;” statement is present and comes before my milestone code in the ‘points’ file. It must have appeared in a more recent style file package I downloaded during the past year because my style rules were working perfectly when I finished writing them last October.

I had looked at the ‘name’ file several times when trying to fix this problem but was under the impression that it only affected objects with operator and brand tags, removing duplicates, etc., and FIXME tags. But when I got your reply I looked at that file more carefully and noticed this rule:

None of operator, brand given

ref=* & (operator!=* & brand!=*) { name ‘${ref} ${name}’ | ‘${ref}’ }

which when commented out gave me back my full text. If I’m reading it correctly, that rule operates on the ref tags of any and all objects that have no operator or brand tags. It’s much too all inclusive, dangerous even. I’m surprised it’s in the name file at all.

I don’t want or need that rule for my maps but, for the sake of argument, let’s say I wanted to find another way to solve my problem. Is there a way to use the SET operator to force my other two rules to set the name tag? I’ve tried it in all sorts of configurations and it had no effect. Here’s an example:

highway=milestone & ref!=* & distance!=* {set name='M/S'} [0x05a00 resolution 24]
highway=milestone & distance=0 {set name='Km 0: ${ref}' | 'Km 0' ;} [0x05a01 resolution 24]
highway=milestone {set name='${ref} (${distance})' | set name='Rte ${ref}' | set name='${distance} km' ;} [0x05a00 resolution 24]

I’ve tried placing the semicolon in different places, using a single SET operator in the second rule, etc. They all pass through mkgmap without throwing an error but they have no effect. SET works in the first rule but not for the other two. Why is that so?

Thank you in advance for your time and help on this.

My understanding is that “name” can be set only once. You can try to use “mkgmap:label:1” instead (I haven’t tested it), for example:

highway=milestone & ref!=* & distance!=* {set mkgmap:label:1='M/S'} [0x05a00 resolution 24]

Check about “name” in style-manula.pdf included in mkgmap release.

I reckon you are correct but the style manual says nothing about it AFAIK.

The top rule worked before because when there is no ref tag on the object the “bad rule” in the ‘name’ file does not execute.

Thanks again.