[Mapcss] text

Peter Wendorff wendorff at uni-paderborn.de
Mon Mar 14 14:21:13 GMT 2011

Hi Sebastian.

I'm not sure if there is something in current MapCSS ideas against the 
functionality "inherited" from classical CSS.
In CSS I would suggest a cascading scheme for the labelling fallbacks 
(the @ indicates an attribute - ignore it, if that's not MapCSS syntax), 
but I hope, you get what I mean:

building[@addr:housenumber] {
     text: @addr:housenumber;

building[@addr:housename] {
     text: @addr:housename;

building[@name] {
     text: @name;

building[@name:de] {
     text: @name:de;

The value of text is calculated cascadingly: apply all definitions 
consecutively, overwriting properties, if applied again.
If there is a Tag name:de at a building, it would be applied in my 
example, as it's the last statement applied.


Am 14.03.2011 15:03, schrieb Sebastian Klein:
> Hi,
> this is about the 'text' property and possibilities to determine the 
> text label string.
> At the moment, the only option is to specify a certain key and the 
> renderer will look up the corresponding tag value and display it (if 
> found). This is somewhat limited, it would be nice to show a localized 
> name if present and fall back to the generic or English name 
> otherwise. Or display the name of a building, and if no name is given, 
> show the house number. This would be written like 'text-source: auto;' 
> or 'text-method: building;'. On top of that, is should be possible to 
> provide a static string as label or use an eval expression to 
> determine the text value.
> Compared to a simple property such as 'width: 5;', the 'text' property 
> works in a more complicated manner as it explicitly refers to the 
> object tags. So it might be appropriate to change the name to 
> something more complicated, like 'text-from-tag'. It is less 
> memorable, but more clear in meaning.
> Any suggestions how all this could be represented?
> Sebastian
> (related ticket: http://josm.openstreetmap.de/ticket/6107)
> _______________________________________________
> Mapcss mailing list
> Mapcss at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/mapcss

More information about the Mapcss mailing list