Opened 13 years ago
Last modified 10 years ago
#7151 new enhancement
MapCSS: support multiple relations per child selector
Reported by: | ikonor | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core mappaint | Version: | |
Keywords: | Cc: | imagic, plepe |
Description
Based on the Osmc hiking style for SK/CZ I tried to build a more general hiking style for the osmc:symbol tag (hiking-current.mapcss). But currently child selectors are restricted to execute the rule declaration for the first matching relation only. This allows only limited and very verbose styles with lots of repetitions.
To demonstrate what I am trying to achieve, I attached a more generic MapCSS style (hiking-demo.mapcss) along with a patch (hiking-demo.patch) to specifically support that style by changing the current behaviour for relation child selectors and adding a few functions. The patch is just a throw-away hack and not intended to be commited. For sample map data you could use [1].
Based on this demo I would like to request the following features:
- allow declaration execution for all matching parents of a child selector
For example by introducing a new selector type ">>":
relation[route=foot] > way { /* executes only once for first matching relation */ } relation[route=foot] >> way { /* executes for all matching relations */ }
(To avoid properties being overwritten on multiple executions, the demo creates "dynamic" layers by adding an execution index to the layer name. But this prevents access to common properties across those dynamic layers, the demo workaround is to set (set_prop function) and read properties of a different layer)
- setting cross-layer (global) properties/tags
Allow properties/tags, e.g. a counter, to be set and shared from different layers (demo: set_prop function). Implementing MapCSS/0.2 "set" instruction would solve this by setting a temporary/transient tag on the object that could then be used in all declarations and selectors.
- shield (MapCSS/0.2)
Shields for ways, e.g. for hiking symbols, road or public transport refs. Ideally with automatic placement for multiple shields per way, or simply with an offset property (demo uses icon and symbol on the middle node of a way, but only one due to missing offset property).
- regex function
Regular expressions in declarations with capturing group(s).
- color text function or auto-conversion
to set a color text (e.g. "blue") as a result of an eval.
[1] http://open.mapquestapi.com/xapi/api/0.6/map?bbox=9.397414,47.722764,9.442046,47.74649
Attachments (4)
Change History (7)
by , 13 years ago
Attachment: | hiking-current.mapcss added |
---|
comment:1 by , 10 years ago
I could also use a looping selector (feature 1), but I don't think that different "dynamic" layers are a good idea.
I would use such feature to display the information given by multiple destination_sign relations. This would be done within one single layer by creating an embedded svg.
comment:2 by , 10 years ago
Cc: | added |
---|---|
Component: | Core → Core mappaint |
comment:3 by , 10 years ago
Cc: | added |
---|
style for current, unmodified JOSM