[Mapcss] multi-strokes and subparts

Sebastian Klein bastikln at googlemail.com
Wed Jul 21 16:02:38 BST 2010


Sebastian Spaeth wrote:
> On Tue, 13 Jul 2010 23:09:53 +0200, Sebastian Klein <bastikln at googlemail.com> wrote:
>> E.g. you have a large and nice standard style file. But then you simply 
>> want to show motorways on half transparent map:
>>
>> [...] standard styles [...]
>> node::*, way::*, relation::* { opacity: eval(0.1 * prop(opacity)); }
>> way[highway=motorway] { opacity: 1; width: eval(1.4 * prop(width)); 
>> z-index: 100; }
>> (The example is a little artificial, but maybe you get the idea.)
> 
> Yes, I agree that ::* should probably be able to override
> things. However in your example you say:
>         way::* { a; } 
>         way::A { b; } 
> 
> is equivalent to way::A {a;b;}.
> 
> So ::* works even on subparts that are not yet specified in the style
> sheet? 

Yes, because it might be more natural to specify the general properties
first, then go on with the special cases e.g.:

 way::* { font-family : sans }
 /* lots of styles here, some of them override font-family */

rather than

 /* lots of styles */
 way::* { font-family : sans }
 /* override font-family for some of the styles above */


Or would it only apply to subparts that have been created before?
> As in:
>         way::A { b; } 
>         way::* { a; } 
>         way::B { c; } 
> ===>way::A { a; b;} 
>     way::B { c;}

You could do it this way as well, but for now I chose the other option.

>> I implemented it a little different. The approach is described on the wiki:
>> http://wiki.openstreetmap.org/wiki/Talk:MapCSS/0.2
> 
> I agree with your approach of having ::* override stuff, but I don't get
> this:
> 
>>   way[highway=footway] { width: 2; z-index: 3; } 
>>   way[fixme]::fixme_highlight { width: 10; z-index: 2; color: red; text: "fixme"; font-size: 12; } 
> 
>> draws footways with width 2 and highlights all ways if they have the
>> FIXME key.
> 
> So this draws 2 things? How do you specify generic styles that can be
> overridden in specific subparts? With ::* rules at the beginning of a file?

Exactly.

>>   way[highway=footway] { width: 2; z-index: 3; } 
>>   way[fixme]::fixme_highlight { width: 10; ...text: "fixme";} 
>>  Otherwise [::default] is just an ordinary subpart.
> 
> This way
>   way[highway=footway] 
> is NOT a superset of
>   way[highway=footway]::centerline
> 
> which is what I argued for earlier. I do believe that the relationship
> between "way" and "way::centerline" should be the same as for "way" and
> "way[highway]".

I know, and from a theoretical point of view, it would be nice. But it
has some strange practical implications:


way[highway=residential] {
 color: orange;
 width: 9;
 casing-width: 0.5;
 casing-color: gray;
 text: name;
 text-color: black;
 font-size: 9;
 text-position: line;
}

way[fixme]::fixme, way[FIXME]::fixme {
	width: 13;
	color: red;
	opacity: 0.4;
}

If "way" would be superset of "way::fixme", doesn't that mean you get an
additional casing and text for the fixme highlight? You would have to
write something like

	font-size: 0;
	casing-width: 0;

To get rid of these elements.

Another example:

node[amenity=restaurant] {
	icon-image: "amentities/restaurant.png";
	text: "name";
	text-align-y: above;
}

node[amenity=restaurant]::restaurant_cuisine {
	text: "cuisine";
	text-align-y: below;
}

This decorates the restaurant icon with 2 different texts: one for the
name and one for the cuisine. (But this would draw the icon twice if the
subpart would inherit from the selector without subparts.)


This suggests to me that the actual object and the subpart/highlight are
more or less independent parts that generally shouldn't inherit styles
from each other.


Sebastian K.




More information about the Mapcss mailing list