Search code examples
mapserver

How to use a boolean field in mapserver expression?


I have the following class where correctie is a Boolean field.

CLASS
  NAME "vestiging (correctie)"

  EXPRESSION (correctie = TRUE)

  STYLE
    MINSCALEDENOM  100
    MAXSCALEDENOM  19001

    SYMBOL         "dashstip"
    SIZE           20
    ANTIALIAS      true
  END
END

The EXPRESSION part does not work


Solution

  • The problem is connection specific because it has to do with how each connection represents: true|false.

    As you can see the postgis connection uses 't'|'f', but others might use 0|1.

    One trick I have used in the past is to set the field in question to be used temporarily as the label then look on the image and see what values are being rendered in the labels using that field, then you can adjust the mapfile appropriately.