I am not getting map legend in GWC WMTS or WMS service, QGIS returns an error "Returned legend image is flawed". but when I am accessing that layer using WMS in QGIS, Map legend is showing with the layer.enter image description hereenter image description here Also, When I am accessing a small area with the same style, Map legend is showing in GWC WMS service. enter image description here I am using GeoServer version 2.12.2. GWC WMS link: http://localhost/geoserver/gwc/service/wms? WMS link: http://localhost/geoserver/wms?

Anyone knows why Map legend is not working in GWC WMS and WMTS?

  • Can you capture the request that is sent by QGIS to the GeoServer GWC when it gets the error? (For example use Fiddler and in QGIS use the Settings > Options > Network dialogue to configure an httpProxy).
    – nmtoken
    Nov 9, 2018 at 12:03
  • I have captured the request in Fiddler. For request GetLegendGraphics, it returns "This response is encoded, but does not claim to be an image". and request header is "GET /localhost/gwc/service/wms?SERVICE=WMS&&VERSION=1.1.1&SLD_VERSION=1.1.0&REQUEST=GetLegendGraphic&FORMAT=image/jpeg&LAYER=DTM&STYLE=&TRANSPARENT=true HTTP/1.1"
    – user59563
    Nov 10, 2018 at 4:49
  • does WMTS supports Map legend?
    – user59563
    Nov 10, 2018 at 7:01

1 Answer 1


I have fixed this problem. Previously at the time of publishing the layer, I had selected Tile Image Formats: JPEG. Whereas Map legend supports only PNG format. So NOW, I have selected Tile Image Formats to PNG and I am getting map legend in GWC WMS.

Your Answer

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

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