[MapServer-users] mapserver legend for raster data

Trygve Aspenes trygve at aspenes.priv.no
Fri Oct 13 07:24:01 PDT 2023


Hi

I have an idea to generate some static images to be used as legend for 
some RGBA geotiff raster data (already styled) available as layers in a 
mapserver setup.

But I can't figure out if this is possible to do.

I had a look a layer web metadata 
https://mapserver.org/ogc/wms_server.html#web-object-metadata wms_style 
and the following mandatory  wms_style_[style’s_name]_width, 
wms_style_[style’s_name]_legendurl_height, 
wms_style_[style’s_name]_legendurl_format, 
wms_style_[style’s_name]_legendurl_href

So I try with name <raster> having this in the map file:
    METADATA
       "wms_title" "Test raster title"
       "wms_timeextent" "2023-10-12T11:26:00Z/2023-10-12T11:26:00Z"
       "wms_enable_request" "*"
       "wms_style_raster_title" "mylayerstyletitle" #style title
       "wms_style_raster_legendurl_width" "85"
       "wms_style_raster_legendurl_height" "40"
       "wms_style_raster_legendurl_format" "image/png"
       "wms_style_raster_legendurl_href" 
"http://localhost:8080/images/legend.png"
     END

I verified I can reach the png.
Then I add:
     classgroup "raster"
     CLASS
       name "TESTNAME"
       group "raster"
     END

using curl for getlegendgraphic I only get a small png showing 
"TESTNAME", not image content of 'legend.png'.

Anyone know if this is possible achieve?

Trygve Aspenes


More information about the MapServer-users mailing list