
Using mkgmap-r4260 I tried several variations to make a rule match when some tag does not exist: Line: ( highway!=* | oneway!=*) { deletealltags } Error in style: Error: (lines:12): Invalid rule expression: $highway!=*| $oneway!=* Similar error is given when comparing expression with this line: oneway!=* { deletealltags } Tt seems != works fine but only if there is an equal comparision first like in this line that gives no error: highway=* & oneway !=* { deletealltags } Do I missunderstand something or is this a bug? I think I tried some other use case while back and I got similar errors when it started with != comparision first. This may not be a very new issue. Chears, Harri

Also this line seems to give the same error: !(highway=* & oneway=*) { deletealltags } Error in style: Error: (lines:12): Invalid rule expression: $highway!=* | $oneway!=* Hope this helps, as this is a different syntax at least and the same result is still complained of. On 1/3/19 2:35 PM, Harri Suomalainen wrote:
Using mkgmap-r4260 I tried several variations to make a rule match when some tag does not exist:
Line: ( highway!=* | oneway!=*) { deletealltags } Error in style: Error: (lines:12): Invalid rule expression: $highway!=*| $oneway!=*
Similar error is given when comparing expression with this line: oneway!=* { deletealltags }
Tt seems != works fine but only if there is an equal comparision first like in this line that gives no error: highway=* & oneway !=* { deletealltags }
Do I missunderstand something or is this a bug?
I think I tried some other use case while back and I got similar errors when it started with != comparision first. This may not be a very new issue.
Chears, Harri _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

See this note in the style manual: There used to be some restrictions on the kind of expression you could use. Now the only restriction is you must have at least one test that depends on a tag existing. So you cannot match on everything, regardless of tags, or test for an object that does not have a tag. Lorenzo Il giorno gio, 03/01/2019 alle 15.05 +0200, Harri Suomalainen ha scritto:
Also this line seems to give the same error: !(highway=* & oneway=*) { deletealltags }
Error in style: Error: (lines:12): Invalid rule expression: $highway!=*
$oneway!=*
Hope this helps, as this is a different syntax at least and the same result is still complained of.
On 1/3/19 2:35 PM, Harri Suomalainen wrote:
Using mkgmap-r4260 I tried several variations to make a rule match when some tag does not exist:
Line: ( highway!=* | oneway!=*) { deletealltags } Error in style: Error: (lines:12): Invalid rule expression: $highway!=*| $oneway!=*
Similar error is given when comparing expression with this line: oneway!=* { deletealltags }
Tt seems != works fine but only if there is an equal comparision first like in this line that gives no error: highway=* & oneway !=* { deletealltags }
Do I missunderstand something or is this a bug?
I think I tried some other use case while back and I got similar errors when it started with != comparision first. This may not be a very new issue.
Chears, Harri _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk

On 1/3/19 1:35 PM, Harri Suomalainen wrote:
Do I missunderstand something or is this a bug?
I think it's a bug. The same problem occurs with the "if .. then" syntax: This works: if (railway=*) then if (tunnel=yes) then () {delete railway} else railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end This does not: if (railway=*) then if (tunnel!=yes) then railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end end "Error in style: Error: (lines:196): Invalid rule expression: $tunnel!=yes" This also does not work: if (railway=* & tunnel!=yes) then railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end You cannot use the "!=" test in "if .. then" syntax at all as far as I can tell.

Hi Ralf, yes, I think this is a bug. In opposite to the previously posted rules your rules should work. @Steve: If I got that right the ExpressionArranger kicks in too early. It should only be called when the if-stack is empty (again). Can you have a look at it? Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Ralf Kleineisel <ralf@kleineisel.de> Gesendet: Freitag, 4. Januar 2019 22:00 An: Development list for mkgmap Betreff: Re: [mkgmap-dev] Not-equal compare bug? On 1/3/19 1:35 PM, Harri Suomalainen wrote:
Do I missunderstand something or is this a bug?
I think it's a bug. The same problem occurs with the "if .. then" syntax: This works: if (railway=*) then if (tunnel=yes) then () {delete railway} else railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end This does not: if (railway=*) then if (tunnel!=yes) then railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end end "Error in style: Error: (lines:196): Invalid rule expression: $tunnel!=yes" This also does not work: if (railway=* & tunnel!=yes) then railway=rail [0x14 resolution 21] railway=tram [0x14 resolution 22] end You cannot use the "!=" test in "if .. then" syntax at all as far as I can tell. _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Gerd
yes, I think this is a bug. In opposite to the previously posted rules your rules should work. @Steve: If I got that right the ExpressionArranger kicks in too early. It should only be called when the if-stack is empty (again). Can you have a look at it?
If you have: if (railway=*) then if (tunnel=no) then railway=rail [0x14 resolution 21] () { set tunnel = yes } railway=tram [0x15 resolution 21] end end This is converted (correctly) to: $tunnel=no {set mkgmap:if:2='true';} $tunnel=no & $railway=rail & $railway=* [0x14 level 2] $tunnel=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram & $railway=* [0x15 level 2] But with tunnel!=no instead, this becomes: $tunnel!=no {set mkgmap:if:2='true';} $tunnel!=no & $railway=rail & $railway=* [0x14 level 2] $tunnel!=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram & $railway=* [0x15 level 2] and so fails on the first statement. The only way to fix this that springs to mind is to instead convert this to: railway=* && $tunnel!=no {set mkgmap:if:2='true';} $tunnel!=no & $railway=rail & $railway=* [0x14 level 2] $tunnel!=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram [0x15 level 2] Steve

Hi Steve, yes, I think the last block is was what I expected. The first block for tunnel=no surprised me because of the missing railway=* clause in the first rearranged rule. Gerd ________________________________________ Von: mkgmap-dev <mkgmap-dev-bounces@lists.mkgmap.org.uk> im Auftrag von Steve Ratcliffe <steve@parabola.me.uk> Gesendet: Samstag, 5. Januar 2019 19:41 An: mkgmap-dev@lists.mkgmap.org.uk Betreff: Re: [mkgmap-dev] Not-equal compare bug? Hi Gerd
yes, I think this is a bug. In opposite to the previously posted rules your rules should work. @Steve: If I got that right the ExpressionArranger kicks in too early. It should only be called when the if-stack is empty (again). Can you have a look at it?
If you have: if (railway=*) then if (tunnel=no) then railway=rail [0x14 resolution 21] () { set tunnel = yes } railway=tram [0x15 resolution 21] end end This is converted (correctly) to: $tunnel=no {set mkgmap:if:2='true';} $tunnel=no & $railway=rail & $railway=* [0x14 level 2] $tunnel=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram & $railway=* [0x15 level 2] But with tunnel!=no instead, this becomes: $tunnel!=no {set mkgmap:if:2='true';} $tunnel!=no & $railway=rail & $railway=* [0x14 level 2] $tunnel!=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram & $railway=* [0x15 level 2] and so fails on the first statement. The only way to fix this that springs to mind is to instead convert this to: railway=* && $tunnel!=no {set mkgmap:if:2='true';} $tunnel!=no & $railway=rail & $railway=* [0x14 level 2] $tunnel!=no & $railway=* {set tunnel='yes';} $mkgmap:if:2=true & $railway=tram [0x15 level 2] Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Hi Rules that would match an element without any tags are not allowed. It might be possible to allow that, but I think that it would be slow. Most nodes have no tags and are just part of some way, any rule that matches on the absence of a tag would select almost all of the nodes. If anyone wants to experiment then please go ahead, it could be that I am wrong and it can be done reasonably quickly. As things are however, it is intentional that the rules you are trying do not work.
Line: ( highway!=* | oneway!=*) { deletealltags }
This would match a way with no tags, so is not allowed.
Similar error is given when comparing expression with this line: oneway!=* { deletealltags }
This too.
Tt seems != works fine but only if there is an equal comparision first like in this line that gives no error: highway=* & oneway !=* { deletealltags }
Adding the highway=*, means that it could not match a way without tags, and is therefore allowed. Cheers Steve
participants (5)
-
Gerd Petermann
-
Harri Suomalainen
-
Lorenzo Mastrogiacomi
-
Ralf Kleineisel
-
Steve Ratcliffe