I figured out that mkgmap does already support nested relations, but it
is not working for me. The attached patch attempts to copy the route name
to the members of member relations. This is the relation in question:
<relation id='155054' timestamp='2010-01-03T22:13:56Z' uid='93285'
user='skela' visible='true' version='3' changeset='3533281'>
<member type='relation' ref='375952' role='stop' />
<member type='way' ref='2735495' role='' />
<member type='relation' ref='375951' role='stop' />
The route name is successfully applied to relation 375952 (and its members)
and way 2735495, but according to an echo action that I added, not even
the outer apply is executed on relation 375951. What am I doing wrong?
I could not see any obvious bug in the code.
In the future, I think that it might be useful if apply supported the
following:
* apply role ~ 'regexp' {} notation,
e.g., for matching '\(forward_\|backward_\)?stop'
* apply node ...
for applying only to member nodes
* apply way ...
for applying only to member ways
* apply relation ...
for applying only to subrelations
* apply cond <conditions> { <actions> }
for conditions on the attributes of relation members
Best regards,
Marko
Index: resources/styles/default/relations
===================================================================
--- resources/styles/default/relations (revision 1462)
+++ resources/styles/default/relations (working copy)
@@ -11,12 +11,28 @@
# and http://wiki.openstreetmap.org/wiki/Mkgmap/help/Custom_styles
# for more information.
-# eg. type=route & route=bus { apply { set route=bus; add rn='${route_no}' ; }}
-#
-
+# Names of administrative boundaries
(type=boundary | type=multipolygon) & boundary=administrative & name=*
{ apply
{
set mkgmap:boundary_name='$(mkgmap:boundary_name)/${name}' | '${name}';
}
}
+
+# Public transportation routes
+type=route
+& (route=bus|route=trolleybus|route=ferry|route=subway|route=train|route=tram)
+& (ref=* | name=*)
+{
+ add ref='${name}'; # if ref is missing, use name
+ # Append the ref of the route relation to the route_ref attribute of
+ # the member nodes recursively (even to members of subrelations).
+ # Stops can be grouped within subrelations comprising the vehicle
+ # stop node and the passenger wait node.
+ apply {
+ set route_ref='$(route_ref),${ref}' | '${ref}';
+ apply {
+ set route_ref='$(route_ref),${route_ref}' | '${route_ref}';
+ }
+ }
+}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev