Hi Trygve,

LABEL EXPRESSION isn't listed in the supported parameters at 
https://mapserver.org/cgi/runsub.html#parameters-supported, so I don't think 
this will work.

If using WMS to handle this case, I'd typically add a new CLASS for the labels, 
with a GROUP property set to "labels" and then request the same layer twice 
with different styles, e.g.

    CLASSGROUP "basic"

    CLASS
      GROUP "labels"
      LABEL
...
      END
    END
    CLASS
      GROUP "basic"
...

Request querystring would then include: 
STYLES=basic,labels&LAYERS=mylayer,mylayer

Seth

--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika@mastodon.social

On Thu, Feb 13, 2025, at 9:37 AM, Trygve Aspenes via MapServer-users wrote:
> 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
> _______________________________________________
> MapServer-users mailing list
> MapServer-users@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to