Modify

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:

  1. 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)
  1. 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.
  1. 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).
  1. regex function
    Regular expressions in declarations with capturing group(s).
  1. 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)

hiking-current.mapcss (5.0 KB ) - added by ikonor 13 years ago.
style for current, unmodified JOSM
hiking-demo.mapcss (5.8 KB ) - added by ikonor 13 years ago.
style for patched JOSM
hiking-demo.patch (12.2 KB ) - added by ikonor 13 years ago.
demo patch, not intended to be committed
hiking-demo-screenshot.png (339.3 KB ) - added by ikonor 13 years ago.
demo screenshot

Download all attachments as: .zip

Change History (7)

by ikonor, 13 years ago

Attachment: hiking-current.mapcss added

style for current, unmodified JOSM

by ikonor, 13 years ago

Attachment: hiking-demo.mapcss added

style for patched JOSM

by ikonor, 13 years ago

Attachment: hiking-demo.patch added

demo patch, not intended to be committed

by ikonor, 13 years ago

Attachment: hiking-demo-screenshot.png added

demo screenshot

comment:1 by imagic, 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 imagic, 10 years ago

Cc: imagic added
Component: CoreCore mappaint

comment:3 by plepe, 10 years ago

Cc: plepe added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to ikonor.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.