[MapServer-users] LAYER expression nested in a CLASS with expression

Trygve Aspenes trygve at aspenes.priv.no
Thu Feb 13 00:37:42 PST 2025


I have a layer with a class consisting of a symbol and potential a label 
like this:

        CLASS
             NAME "   TEST_NAME"
             EXPRESSION ([var1]>=8 and [var1]<13)
             STYLE
                 SYMBOL "SYMBOL1"
                 COLOR 0 255 0
             END
             LABEL
                 EXPRESSION ('%showlabel%' eq 'ON')
                 TEXT ([labelvalue])
                 FONT "dejavusans"
                 TYPE truetype
                 SIZE 7
                 COLOR 0 255 0
                 POSITION UR
             END
         END

What I want is to plot symbol symbol1 when var1 is between 8 and 13. And 
if the SHOWLABEL parameter from the request url is set to ON also plot 
the label labelvalue. This symbol1 is plotted, but the label is not 
plottet whether the showlabel is set to ON or not. No error message from 
mapserver.

So I guess the expression in the LABEL is silently ignored.

I can make two classes, one without the label and one with the label. 
And make one expression handeling the showlabel which class to use. But 
I have hoped to avoid that as I have quite many classes.

Any ideas if this is possible to achive?

Trygve Aspenes


More information about the MapServer-users mailing list