Bug in handling of bus stops

This bug was highlighted in r3334 when the test public_transport=platform was added to these four rules in the default points style file (lines 45-63): (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) { set ref='${ref|def:}(${route_ref})'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}*'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit!=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}+'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (shelter=no | covered=no) { set ref='${ref|def:}-'; } What happens is that if a node has two of the tags in the list public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station then the node is processed twice by each rule, so the route_ref and the shelter marker (*, + or -) are doubled-up. Looking at https://www.openstreetmap.org/node/1424432523 - this node is tagged public_transport=platform and highway=bus_stop. Prior to r3334, the node had only one tag that matched and there was no doubling-up. From r3334 onwards, there are two tags that match and the result is Agglo Hérault Méditerranée: (1;2;3;4;5,4,4,3,3)(1;2;3;4;5,4,4,3,3)++ Gare SNCF. I believe it is not intended that style rules should work in this way, therefore it is a bug in the code. In which case it is a question for the Java experts. Adrian

Hi Adrian, I think the solution for the problem is an additional tag. Something like this in all 4 rules: (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) & xxx_ref_processed!=1 { set ref='${ref|def:}(${route_ref})'; set xxx_ref_processed=1 } Gerd A drian wrote
This bug was highlighted in r3334 when the test public_transport=platform was added to these four rules in the default points style file (lines 45-63):
(public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) { set ref='${ref|def:}(${route_ref})'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}*'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit!=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}+'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (shelter=no | covered=no) { set ref='${ref|def:}-'; }
What happens is that if a node has two of the tags in the list
public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station
then the node is processed twice by each rule, so the route_ref and the shelter marker (*, + or -) are doubled-up. Looking at https://www.openstreetmap.org/node/1424432523 - this node is tagged public_transport=platform and highway=bus_stop. Prior to r3334, the node had only one tag that matched and there was no doubling-up. From r3334 onwards, there are two tags that match and the result is Agglo Hérault Méditerranée: (1;2;3;4;5,4,4,3,3)(1;2;3;4;5,4,4,3,3)++ Gare SNCF. I believe it is not intended that style rules should work in this way, therefore it is a bug in the code. In which case it is a question for the Java experts.
Adrian
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/Bug-in-handling-of-bus-stops-tp5832099p583214... Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi Adrian, I was wrong, forget my previous post. You are right, the rule (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) { set ref='${ref|def:}(${route_ref})'; } is divided into two parts: ((($public_transport='platform')&($ref=*|$route_ref=*)) | ((($highway='bus_stop')|(($railway='tram_stop')|(($railway='halt')|($railway='station'))))&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';} ((($highway='bus_stop')&($ref=*|$route_ref=*)) | ((($railway='tram_stop')|(($railway='halt')|($railway='station')))&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';} and each one is executed. This is clearly not intended and should be fixed. Gerd GerdP wrote
Hi Adrian,
I think the solution for the problem is an additional tag. Something like this in all 4 rules: (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) & xxx_ref_processed!=1 { set ref='${ref|def:}(${route_ref})'; set xxx_ref_processed=1 }
Gerd A drian wrote
This bug was highlighted in r3334 when the test public_transport=platform was added to these four rules in the default points style file (lines 45-63):
(public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (ref=* | route_ref=*) { set ref='${ref|def:}(${route_ref})'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}*'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit!=yes & (shelter=yes | covered=yes) { set ref='${ref|def:}+'; } (public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & (shelter=no | covered=no) { set ref='${ref|def:}-'; }
What happens is that if a node has two of the tags in the list
public_transport=platform | highway=bus_stop | railway=tram_stop | railway=halt | railway=station
then the node is processed twice by each rule, so the route_ref and the shelter marker (*, + or -) are doubled-up. Looking at https://www.openstreetmap.org/node/1424432523 - this node is tagged public_transport=platform and highway=bus_stop. Prior to r3334, the node had only one tag that matched and there was no doubling-up. From r3334 onwards, there are two tags that match and the result is Agglo Hérault Méditerranée: (1;2;3;4;5,4,4,3,3)(1;2;3;4;5,4,4,3,3)++ Gare SNCF. I believe it is not intended that style rules should work in this way, therefore it is a bug in the code. In which case it is a question for the Java experts.
Adrian
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/Bug-in-handling-of-bus-stops-tp5832099p583214... Sent from the Mkgmap Development mailing list archive at Nabble.com.

Am Sonntag, 1. Februar 2015, 11:42:38 schrieb GerdP:
This is clearly not intended and should be fixed.
Hi FYI Franco fixed this in May 2014 in our style with this workaround https://github.com/berndw1960/aiostyles/commit/0209b139bd7ec07ff24a31d86ba30... public_transport=platform & (amenity=bus_station | highway=bus_stop | railway=tram_stop | railway=halt | railway=station) { #eliminate double ^ or double - ; no idea why they are entered twice otherwise delete public_transport; } Bernd

Hi Bernd, I think the no-dup-rule-evaluation-v2.patch solves this problem. The logging function for the style stats now shows more clearly how a single rule in the style file is translated into one or more rules, e.g. (a |b | c) & (e | f) { action xyz} is translated to (a ) & (e | f) { action xyz} (b) & (e | f) { action xyz} (c) & (e | f) { action xyz} Without the patch it is possible that each part is executed. The style stats will now look like this: INFO: uk.me.parabola.mkgmap.osmstyle.stats 63240001.o5m: points stats (rule/evals/true) rule-id: 16 ((($public_transport='platform')&($ref=*|$route_ref=*)) | ((($highway='bus_stop')|(($railway='tram_stop')|(($railway='halt')|($railway='station'))))&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';}/95/60 INFO: uk.me.parabola.mkgmap.osmstyle.stats 63240001.o5m: points stats (rule/evals/true) rule-id: 16 ((($highway='bus_stop')&($ref=*|$route_ref=*)) | ((($railway='tram_stop')|(($railway='halt')|($railway='station')))&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';}/984/490 INFO: uk.me.parabola.mkgmap.osmstyle.stats 63240001.o5m: points stats (rule/evals/true) rule-id: 16 ((($railway='tram_stop')&($ref=*|$route_ref=*)) | ((($railway='halt')|($railway='station'))&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';}/0/0 INFO: uk.me.parabola.mkgmap.osmstyle.stats 63240001.o5m: points stats (rule/evals/true) rule-id: 16 ((($railway='halt')&($ref=*|$route_ref=*)) | (($railway='station')&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';}/11/11 INFO: uk.me.parabola.mkgmap.osmstyle.stats 63240001.o5m: points stats (rule/evals/true) rule-id: 16 # Part of the previous OR expression: ((($railway='station')&($ref=*|$route_ref=*))) {set ref='${ref}(${route_ref})';}/23/9 Gerd
From: weigelt.bernd@web.de To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 2 Feb 2015 09:35:26 +0100 Subject: Re: [mkgmap-dev] Bug in handling of bus stops
Am Sonntag, 1. Februar 2015, 11:42:38 schrieb GerdP:
This is clearly not intended and should be fixed.
Hi FYI
Franco fixed this in May 2014 in our style with this workaround
https://github.com/berndw1960/aiostyles/commit/0209b139bd7ec07ff24a31d86ba30...
public_transport=platform & (amenity=bus_station | highway=bus_stop | railway=tram_stop | railway=halt | railway=station)
{ #eliminate double ^ or double - ; no idea why they are entered twice otherwise delete public_transport; }
Bernd _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Am Montag, 2. Februar 2015, 09:59:00 schrieb Gerd Petermann:
I think the no-dup-rule-evaluation-v2.patch solves this problem.
Will try this patch a few hours later, have no time now I hope, it doesn't have side effects, you know, that we're using many difficult rules ;-) Bernd -- amarok2 now playing:

Hi Bernd, you can enable logging with uk.me.parabola.mkgmap.osmstyle.RuleSet.level=FINE and look for messages containing this: "skipping part of rule" Gerd
From: weigelt.bernd@web.de To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 2 Feb 2015 10:19:13 +0100 Subject: Re: [mkgmap-dev] Bug in handling of bus stops
Am Montag, 2. Februar 2015, 09:59:00 schrieb Gerd Petermann:
I think the no-dup-rule-evaluation-v2.patch solves this problem.
Will try this patch a few hours later, have no time now
I hope, it doesn't have side effects, you know, that we're using many difficult rules ;-)
Bernd
-- amarok2 now playing:
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Am Montag, 2. Februar 2015, 10:27:46 schrieb Gerd Petermann:
Hi Bernd,
you can enable logging with uk.me.parabola.mkgmap.osmstyle.RuleSet.level=FINE and look for messages containing this: "skipping part of rule"
Hello Gerd Wow, made a fast test with my Bonn extract, 1 GB logfiles with only one line 2015/02/02 10:47:31 FEIN (RuleSet): /home/bernd/map_build/tiles/65000031.o5m: skipping part of rule 392 # Part of the previous OR expression: ((($last:word='Laan')&$last:word=*)) {delete last:word;} because previous part matched already for http://www.openstreetmap.org/way/85641102 Bernd -- amarok2 now playing:

Hi Bernd, I think that is plausible. The problem should not appear often, else someone would have complained earlier. Gerd
From: weigelt.bernd@web.de To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 2 Feb 2015 10:50:32 +0100 Subject: Re: [mkgmap-dev] Bug in handling of bus stops
Am Montag, 2. Februar 2015, 10:27:46 schrieb Gerd Petermann:
Hi Bernd,
you can enable logging with uk.me.parabola.mkgmap.osmstyle.RuleSet.level=FINE and look for messages containing this: "skipping part of rule"
Hello Gerd
Wow, made a fast test with my Bonn extract, 1 GB logfiles with only one line
2015/02/02 10:47:31 FEIN (RuleSet): /home/bernd/map_build/tiles/65000031.o5m: skipping part of rule 392 # Part of the previous OR expression: ((($last:word='Laan')&$last:word=*)) {delete last:word;} because previous part matched already for http://www.openstreetmap.org/way/85641102
Bernd
-- amarok2 now playing:
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (4)
-
A drian
-
Bernd Weigelt
-
Gerd Petermann
-
GerdP