I have three vector layers showing the same information but with a different level of details. In fact, despite the same symbology and attribute table, there is a need to display them at different scales. So I published my 3 layers (lets say layer_A, layer_B and layer_C), created a default style for each one (which are exactly the same except for the Min/MaxScaleDenominator values) and then I integrated them into one layer group (lets say layer_Z) as an Opaque Container. Doing this allow me to use only one layer through my webmapping OL interface but also for the enduser who want to consume the WMS with QGIS.

Everything is working really nice except that in QGIS I've got a legend for each layer in my layergroup ... but they are all the same ! What I'm looking for is creating a single layer (as a layer group), with the 3 layers displaying data on their respective scales (lets say layer_A: 1:50000 to 1:25000 , layer_B: 1:25000 to 1:10000 and layer_C: 1:10000 to 1:100) but using the same symbology (lets say polygons are blue if is_colorized field is True but grey if is_colorized field is False) and only one legend is displayed for this symbology.

I've tried a lot of different tuning (using Earth Observation Tree mode, creating a layer group style, etc.) but nothing works... so if you've got a clue don't hesitate!

If needed, I can join some part of my configuration, of the .sld config, or anything else.


The duplicated legend I currently get


  • Geoserver: v2.23 (served through Jetty)
  • Java: OpenJDK v17
  • QGIS: v3.30
  • OS: Windows 10


  • that's expected behaviour
    – Ian Turton
    May 23 at 14:30
  • I put in bold the expected behaviour which is not the actual. Actually, I've got a legend for each layer in the layer group and the goal is to get only one legend. Because, it's 3 layers but it's the same symbology.
    – FloCAD
    May 23 at 14:37
  • @IanTurton I added a screenshot also if it wasn't clear
    – FloCAD
    May 23 at 14:42
  • 1
    No, that is what I expect the legend graphic to do (and I think I wrote that code) it doesn't know that you are using the same layer 3 times
    – Ian Turton
    May 23 at 14:57
  • Alright, I didn't said that it was a bug but that it doesn't match with my needs. Obviously, displaying the legend of all the layers is kind of logic but here, there is only one legend to display. I also tried to put a .jpeg image file as a legend but doesn't work for the layer group. If you know how to make it works let me know, but now I'm stuck...
    – FloCAD
    May 23 at 15:08

1 Answer 1


Well, I've just found a solution to my problem so I'll post it to help others who may have the same need.

My goal was to get a single layer containing 3 layers presenting the same data but at 3 different scales, so the symbology was the same for all three layers.

My hack therefore consisted in modifying the default legend of the first two layers by implementing, in their respective styles, a fake legend in image format of 1 white pixel.

It's a bit hacky but it's working like I expected for this specific purpose. See the result below:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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