[MapServer-users] Default value for CLASS STYLE SYMBOL as attribute when requeting GetLegendGraphics

Trygve Aspenes trygve at aspenes.priv.no
Sat Mar 29 01:20:24 PDT 2025


Hi all

I have a Layer with a CLASS STYLE like this
CLASS
  NAME "Name of class"
  GROUP "groupname"
  EXPRESSION ('[var]' >= '0' and '[var]' < '33')
  STYLE
      SYMBOL [symbol_name]
      COLOR "some color"
  END
END

This work fine when requesting GetMap as I get the symbol_name from my 
postgis.

However, when requesting GetLegendGraphics the legend only shows the 
name of the class, and not the symbol. I think this is because mapserver 
for getlegendgraphics don't have any value for the attribute 
symbol_name. If I turn on debugging a request with getlegendgraphics 
don't do any queries to the postgis, as expected because 
getlegendgraphics request don't contain all the info needed to make a 
query to the postgis.

In documentation for SYMBOL here 
https://mapserver.org/mapfile/style.html#style (almost at the bottom) 
the default value of symbol number 0 is only used when a SYMBOL is given 
as an integer.

So, is there a way I can set default value for SYMBOL when this is given 
as an attribute to make the symbol show for getlegendgraphics requests?

Trygve Aspenes


More information about the MapServer-users mailing list