[Mapcss] relative width for overlays

Komяpa me at komzpa.net
Sat Oct 2 19:46:09 BST 2010


>> I would like to create transparent overlay for bridges and tunnels that
>> is 4 pixels wider than the main line style. How can this be done without
>> repeating all highway types?
>
> In Halcyon this is done by accessing a special '_width' variable, which has
> the width of the widest rendered stroke, so:
>
> way :selected { z-index: 2; width: eval('_width+10'); color: yellow;
> opacity: 0.7;}
>
> (see
> http://svn.openstreetmap.org/applications/editors/potlatch2/net/systemeD/halcyon/styleparser/StyleChooser.as
> and, in particular, tags['_width']=sl.maxwidth; r.runEvals(tags);)
>
> As ever, very open to better ways of doing it. :)

The question is not as simple as it seems.
You need to get a width of stroke on another sublayer. For now,
proposed eval() syntax lets you get only properties from current
sublayer.

What I propose is to allow prop() have an optional second argument -
name of sublayer to get properties from. So I'd propose:

way[bridge=yes]::bridge-over {
   color: #000080;
   opacity: 0.5;
   z-index: 0.01;
   width: eval(num(prop("width", "default"))+4);
}

Any better ideas?

-- 
Darafei "Komяpa" Praliaskouski
OSMF BY Team
xmpp:me at komzpa.net mailto:me at komzpa.net



More information about the Mapcss mailing list