1

Is it possible to set the order of the displayed elements (Layers) in the legend graphic recieved by WMS GetLegendGraphicREQUEST or will MAPSERVER always return in the order of layers defined in the map-file?

1

GetLegendGraphic has a mandatory parameter LAYER which accepts only one layer as a value mapserver.org/ogc/wms_server.html?. So you cannot order the layers because there will always be just one. Sort of an exception is group layer but you cannot sort that either: "If the requested layername is a GROUP-name, all included layers will be returned in the legend-icon."

Also the classes within the layer appear in the legend in the same order than they are defined in the mapfile.

MapServer has also it's own and peculiar legend system http://mapserver.org/output/html_legend.html#html-legend. It probably gives more flexibility but those legends can't be accessed with the WMS GetLegendGraphic request.

1
  • Thank you. I forgot to mention that I am using a group layer. so I wanted to set the order of all my layers inside the group. sadly the legend shows the last definied layer as the first :-(
    – Max
    Apr 23 '18 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.