[Mapcss] How do I use an eval statement to set multiple selectors properties and values ?

william skora skorasaurus at gmail.com
Sat Aug 3 17:12:24 UTC 2013


I'm trying to style the names (so that they have a halo around them, and
will later on add font size based on area size),being displayed for various
areas in my mapcss style using an eval expression, but the styling is not
applying and I don't know why.

Using the code from
https://josm.openstreetmap.de/browser/trunk/styles/standard/potlatch2.mapcss

I set the property and value as prop_area_small_name : 1;
inside the selectors that I wanted to style together, as shown at:
https://github.com/skorasaurus/HDM-JOSM-style/blob/8b635ecdc95d58ff193aa0ece23299bcc18dc38a/HDM.mapcss#L558

Later in the file, I styled these areas
https://github.com/skorasaurus/HDM-JOSM-style/blob/1327c2fc7ae259c8e6a7ea93fa612c6a32692d35/HDM.mapcss#L1554
(I noticed that the text-halo should be text-halo-color in that selector,
according to http://wiki.openstreetmap.org/wiki/MapCSS/0.2#Label_propertiesand
I made this fix)
and the names of the areas were not being styled as I intended.

Reading https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementationI
figured out that the styling in potlatch2 above is likely deprecated,
so
I tried a different approach as written in the grammar section:
https://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Grammar

for each selector that I wanted to style, I included the line:
small_area : true;
as shown at:
https://github.com/skorasaurus/HDM-JOSM-style/blob/823fad20dd289c01a97bd43df72fc4363ba8ce58/HDM.mapcss#L558

then, later set,
https://github.com/skorasaurus/HDM-JOSM-style/blob/823fad20dd289c01a97bd43df72fc4363ba8ce58/HDM.mapcss#L1555
{
    text-color: black;
    font-size: 10;
    text: name;
    text-halo-color: white;
    text-halo-radius: 2;
    text-position: center;
}

However, this styling is still not being applied to the selectors that I
have set to small_areas. How do I fix this ?

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/mapcss/attachments/20130803/afa7ec4f/attachment.html>


More information about the Mapcss mailing list