[Mapcss] Questions concerning tests

Stephan Bösch-Plepelits skunk at xover.htu.tuwien.ac.at
Mon Sep 16 20:57:08 UTC 2013


On Mon, Sep 16, 2013 at 10:16:52PM +0200, Tom Davie wrote:
> On 16 Sep 2013, at 21:32, Stephan Bösch-Plepelits <skunk at xover.htu.tuwien.ac.at> wrote:
> > 
> > 1. Unary tests
> > --------------
> > The MapCSS 0.2 specification[1] says the following about unary tests:
> >  way[highway]       /* Matches against all ways with the highway tag set */
> >  way[!highway]      /* Matches against all ways with the highway tag not set (or set to no/false) */
> > 
> > Question: Wouldn't it be more logical if the first statement does not match
> > ways with the highway tag set to no or false?
> 
> No, you can already test for that with way[highway=false], you can’t test for the tag not existing any other way.
> 
You contradict the specification in your statement, because the test for a
non-existing tag also matches 'no' and 'false' (as cited above).

According to specification:
  input value       way[highway]      way[!highway]
    not set             false             true
    "foobar"            true              false
    "yes"               true              false
    "no"                true              true
    "false"             true              true

I agree with you, that a test for a non-existing tag is useful, especially
as a test way[highway=false] is easy to do, I just want the specification
to be consistent.

> > 2. Eval boolean type
> > --------------------
> > A boolean
> >  expression is considered "false" if it equals to "0", "no", "false" or ""
> >  (empty string); [2]
> > 
> > Question: Shouldn't the unary test (above) also consider "0" as false?
> > 
> > [1] http://wiki.openstreetmap.org/wiki/MapCSS/0.2#Tests
> > [2] http://wiki.openstreetmap.org/wiki/MapCSS/0.2/eval
> 
> No, because the unary test isn’t checking if it’s false or not, it’s checking if it exists or not.  Note, way[highway] should match against things tagged highway=false.
Not according to the specification. As I said, I want the specification to
be consistent.

greetings,
        Stephan
-- 
Seid unbequem, seid Sand, nicht Öl im Getriebe der Welt! - Günther Eich
,---------------------------------------------------------------------.
| Stephan Bösch-Plepelits,                                            |
| Technische Universität Wien   -    Studien Informatik & Raumplanung |
| Projects:                                                           |
| > openstreetbrowser.org > couchsurfing.org > tubasis.at > bl.mud.at |
| Contact:                                                            |
| > Mail: skunk at xover.mud.at > Blog: plepe.at                         |
| > Twitter: twitter.com/plepe > Jabber: skunk at jabber.at              |
`---------------------------------------------------------------------'



More information about the Mapcss mailing list