
Hi i'm playing around with the PT rules in relations, as example this node [1]. The node belongs to two route relations (RE8 and RB27) and one track relation (2324) When i enable the rules in relations i got the labels Unkel (Re8,re8,rb27,rb27) my wanted result is to get only one entry per relations, btw apply_once didn't help this is my code # Public transportation routes. type=route & (route=bus| route=trolleybus| route=ferry| route=subway| route=train| route=tram) & (ref=* | name=*) { add ref='${name}'; apply { set route_ref='$(route_ref),${ref}' | '${ref}'; set mkgmap:relref='${ref}'; apply role=passengers { set route_ref='$(route_ref),${mkgmap:relref}' | '${mkgmap:relref}'; } delete mkgmap:relref; } } How can get this result? And where is my error? Bernd [1] http://www.openstreetmap.org/way/58522211

Am Mittwoch, 7. Januar 2015, 18:11:29 schrieb Bernd Weigelt:
And where is my error?
Found one of my errors, because the node belongs to four route relations. http://www.openstreetmap.org/node/31172863 ok, thats the reason for the double entries, but how can i filter them? Bernd

Am Mittwoch, 7. Januar 2015, 18:29:02 schrieb Bernd Weigelt:
Am Mittwoch, 7. Januar 2015, 18:11:29 schrieb Bernd Weigelt:
And where is my error?
Found one of my errors, because the node belongs to four route relations.
http://www.openstreetmap.org/node/31172863
ok, thats the reason for the double entries, but how can i filter them?
Bernd
With the new filter, it works as expected, there is now only one entry, no double entries in the list now for the node above 'Unkel (Rb27,re8) thank you, Maxim # Public transportation routes. # We could want to sort the matching relations by ref first. type=route & (route=bus| route=trolleybus| route=ferry| route=subway| route=train| route=tram) & (ref=* | name=*) { add ref='${name}'; apply { #set route_ref='$(route_ref),${ref}' | '${ref}'; set route_ref='$(route_ref),${ref|not-contained:,:route_ref}' | '$(route_ref)' | '${ref}'; set mkgmap:relref='${ref}'; apply role=passengers { set route_ref='$(route_ref),${mkgmap:relref}' | '${mkgmap:relref}'; } delete mkgmap:relref; } } -- amarok2 now playing:

I propose that the code presented by Bernd is incorporated into the default relations style file, with the separator changed to a semicolon. Specifically, that line 41 of the file is changed from set route_ref='$(route_ref),${ref}' | '${ref}'; to set route_ref='$(route_ref);${ref|not-contained:;:route_ref}' | '$(route_ref)' | '${ref}'; I have tested this on the example in my previous post http://www.mkgmap.org.uk/pipermail/mkgmap-dev/2015q1/022694.html and it fixes the issue. I have chosen the semicolon because it is the recommended separator in OSM https://wiki.openstreetmap.org/wiki/Semicolon Also, using a comma as separator would not fix my example. Another possibility might be to recognise multiple characters as separators, e.g. the semicolon and the comma would both be treated as a separator. This would depend on whether it is feasible to extend Maxim's patch to recognise multiple separators.

I should have added that I believe my proposal would also work on Bernd's example, although the result would be (Rb27;re8), not (Rb27,re8). Adrian
participants (2)
-
A drian
-
Bernd Weigelt