Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Within classes I'm able to match strings using CLASSITEM, but not when including the field name in the expression, for example (inside a layer declaration):

CLASSITEM "myfieldname"
    EXPRESSION "sometext"

Works fine, but

    EXPRESSION ([myfieldname] = "sometext")

Doesn't return any data

The second method is fine when working with integers, e.g.

    EXPRESSION ([myintegerfieldname] = 10)

I've tried enclosing the strings with single quotes, double quotes, using a regex instead. The same behaviour occurs when the source data is a shapefile or a postgis layer.

Using CLASSITEM is obviously a good work-around, but it would be useful to know what I'm doing wrong with the direct comparison.


share|improve this question
up vote 0 down vote accepted


   EXPRESSION ("[myfieldname]" = "sometext")

this should force mapserver to use the string equality operator on both fields and explains why it does work with numbers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.