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

Richard Greenwood richard.greenwood at gmail.com
Sun Mar 30 15:11:19 PDT 2025


On Sat, Mar 29, 2025, 2:20 AM Trygve Aspenes via MapServer-users <
mapserver-users at lists.osgeo.org> wrote:

> 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
>

How many symbol_name do you have?
Could you use KEYIMAGE?

Richard W. Greenwood
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20250330/19fb537f/attachment.htm>


More information about the MapServer-users mailing list