[Mapcss] relative width for overlays

Sebastian Klein bastikln at googlemail.com
Sun Oct 3 17:14:33 BST 2010


Komяpa wrote:
>>> Thanks for you answers! Because it is so common, I was tempted to use a
>>> shortcut:
>>>
>>>    width: +4;
>> I was going to suggest the same thing. I think the notion of "define
>> this width relative to another width" is so common, it's worth having
>> notation for it.
> 
> This syntax should be thought more to be pushed into more-or-less
> standard mapcss.
> 
> 1) it becomes a lot harder to parse. +1 and 1 are considered the same
> in most programming languages, so you can't just linearly transform
> mapcss into (for example) JSON form, also can't even hold in a single
> variable.

Yes, I'm aware of that, but you cannot hold a complex expression in a 
single primitive variable either. It could also be used for casing-width:
  +4 --> width + 4
  -2 --> width - 2
  10 --> 10

This notation is from JOSM mappaint style format, so maybe it's just 
that I'm too much used to it...

> 2) what should be used for a base for adding and substracting widths?

It refers to the width value in the default layer. (So it would work 
only for layers other that the default layer.)

> 3) Most of those use-cases are well-covered (IMHO) with casing thing.

We need special highlight for
  * bridges
  * tunnels
  * access
  * maxspeed
  * parking-lanes
  * unnamed highways
  * fixme / note
  * TIGER reviewed=no
  * ... (other user defined stuff)

How can all that be done with casing?

As Komяpa has shown, "eval" can be used to express relative widths. Its 
just a little clumsy for such a common task. However "+4" might be 
easier to implement than a full blown eval.

But as I said, it would be just a shortcut and nothing that is needed at 
all costs.


Sebastian



More information about the Mapcss mailing list