[mkgmap-dev] [PATCH] apply_once
From Marko Mäkelä marko.makela at iki.fi on Mon Jan 4 06:35:09 GMT 2010
On Sun, Jan 03, 2010 at 11:10:02PM +0200, Marko Mäkelä wrote: > On Sun, Jan 03, 2010 at 11:33:36AM +0200, Marko Mäkelä wrote: > > Steve, all, > > > > Some relations legitimately contain elements in multiple roles. > > An example is bus routes that partially coincide with oneway streets > > or roundabouts. These are best drawn as closed loops that do cover > > the twoway streets twice (once in role=forward and once in role=backward). > > > > The attached patch implements an apply_once keyword that will apply the > > commands only once per matching relation member. OK to commit? > > If nobody complains, I will commit the apply_once tomorrow. Actually, I think that we will need deep_apply and deep_apply_once as well. These would recursively execute the set/add commands on member relations too. This is necessitated by the fact that according to these wiki pages: http://wiki.openstreetmap.org/wiki/Relation:route http://wiki.openstreetmap.org/wiki/Buses the role=stop members of a transit relation should be nodes on the ways that constitute the route, not POIs defined for passenger waiting areas (such as highway=bus_stop next to the way). Because some applications are interested in the passenger waiting areas and others are interested in the vehicle stop areas, a scheme has been proposed where type=stop relations are defined for the stops, grouping the vehicle stop node and the passenger wait area. I implemented this for one ferry route so far: http://www.openstreetmap.org/browse/relation/155054 Without deep_apply, I guess that the outcome would be nondeterministic. Even if the style file defined separate commands for type=stop relations, it would depend on the evaluation order whether the set/add commands would be executed on the type=stop relations for a type=route relation before the set/add of the type=stop relations would be executed on the member nodes. At http://wiki.openstreetmap.org/wiki/Relation:route I understood that this could also be useful for route relations that consist of smaller route relations. The names of the super-relations could be added to the members with a deep_apply_once statement. If nobody complains, I will add apply_once, deep_apply and deep_apply_once to the style language and add something like this to the default style: relations: +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 + apply_once { set route_ref='$(route_ref),${ref}' | '${ref}' } +} (the apply_once would be replaced with deep_apply_once) Index: resources/styles/default/points =================================================================== --- resources/styles/default/points (revision 1457) +++ resources/styles/default/points (working copy) @@ -97,6 +97,9 @@ amenity=townhall [0x3003 resolution 21] amenity=university [0x2c05 resolution 21] amenity=zoo [0x2c07 resolution 21] +route_ref=* & +(highway=bus_stop | railway=tram_stop | railway=halt | railway=station) +{ set ref='${ref|def:}(${route_ref})' } (highway=bus_stop | railway=tram_stop | railway=halt | railway=station) & lit=yes & (shelter=yes | covered=yes) { name '${name|def:} ${ref|def:}*${operator|def:}'; } Best regards, Marko
- Previous message: [mkgmap-dev] [PATCH] apply_once
- Next message: [mkgmap-dev] Baltic map installer test
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list