Bug report #12610

QGIS not showing WMS legend while LegendURL is present

Added by Kay Warrie almost 5 years ago. Updated about 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Web Services clients/WMS
Affected QGIS version:2.8.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20729

Description

I'am reporting on issue my customer, the Flemish government has reported.
In all of our wms-services, we define a WMS-legend url inside the /WMS_Capabilities/Capability/Layer/Style/LegendURL tag.
But these aren't shown in the table of contents in QGIS.

For example the wms:
http://geo.agiv.be/ogc/wms/product/INBO?SERVICE=WMS&VERSION=1.3.0&request=GetCapabilities
For the layer BWK1Zone the legend url is defined as:
http://geo.agiv.be/ogc/wms/product/INBO?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=BWK1Zone
--> works fine in openlayers and other gis-applications, but not in QGIS.

For wms-services of the Brussels Government these Legends are shown:
http://wms.ibgebim.be/cgi-bin/ibgewms.exe?SERVICE=WMS&VERSION=1.3.0&request=GetCapabilities
For the layer bruenvi_natura_2000_buffer the legend url is defined as:
http://wms.ibgebim.be/ibgewms?sld_version=1.1.0&version=1.3.0&service=WMS&request=GetLegendGraphic&format=image/png&layer=bruenvi_natura_2000_buffer
--> works in openlayers and QGIS.

Is this a Bug in QGIS?
The original question to me in dutch is added as a attachment.

Vraag_ivm_QGIS.pdf - The original question to me in dutch (353 KB) Kay Warrie, 2015-04-20 06:51 AM

LegendError.png (347 KB) Filip Mahieu, 2015-04-28 08:10 AM

LegendError2Composer.png (200 KB) Filip Mahieu, 2015-04-28 08:20 AM

History

#1 Updated by Filip Mahieu over 4 years ago

We do have a similar error here. When loading the WMS url=http://wms.agiv.be/ogc/wms/omkl&layers=Ortho&format=image/png&styles=default&crs=EPSG:31370 by means of that discribed plugin, we get the error 'Returned legend image is flawed', see attachment.

When then using this layer in a composer, Qgis blocks. So this really an issue i think!

Thanks for looking at this!

#2 Updated by Filip Mahieu over 4 years ago

More specific: QGis blocks when effectively adding the legend in the composer. You see in attachment what you get after adding the legend in the composer. you don't get a legend at all, it's rather blank, but there is space.
Then you can't do anything anymore but closing the composer and then Qgis.

#3 Updated by Giovanni Manghi over 4 years ago

  • Target version changed from Version 2.8 to Version 2.8.2
  • Operating System deleted (all)

#4 Updated by Giovanni Manghi over 4 years ago

  • Target version changed from Version 2.8.2 to Version 2.10

#5 Updated by Filip Mahieu over 4 years ago

  • Assignee set to Nyall Dawson

Does this issue have a relation with solved #12234?

#6 Updated by Nyall Dawson over 4 years ago

  • Assignee deleted (Nyall Dawson)

This issue seems to consist of two separate issues. The second (composer hang) is fixed in 2.10 and will be in 2.8.3, not sure if the first is fixed (not showing legend).

#7 Updated by Filip Mahieu over 4 years ago

Nyall Dawson wrote:

This issue seems to consist of two separate issues. The second (composer hang) is fixed in 2.10 and will be in 2.8.3, not sure if the first is fixed (not showing legend).

Indeed, the 'composer hang' is fixed in 2.8.3. But there's still no legend.

#8 Updated by Henrik Uggla over 4 years ago

If I give a layer a (external) legendURL and do GetCapabilities I get:

<Style>
<Name>default</Name>
<Title>default</Title>
<LegendURL>
<Format>image/png</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.osgeo.org/sites/all/themes/osgeo/logo.png"/>
</LegendURL>
</Style>

Which is correct. But when I do GetLegendGraphic I get a simple marker instead. Is this the same bug or should I open a new one (for Qgis Server)?

Qgis Server 2.8.2 on Ubuntu 14.4

Nevermind, I've opened a new bug: 13595

#9 Updated by Giovanni Manghi about 4 years ago

  • Target version deleted (Version 2.10)

#10 Updated by Patrick Valsecchi almost 4 years ago

I'm not sure QGIS is doing anything wrong, there. The URL given for BWK1Zone is clearly wrong. It has only one parameter named request and it has this value: GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=BWK1Zone

If you look at the URL given for layer bruenvi_natura_2000_buffer, it has 7 parameters and they are all good.

This is due of the wrongfull replacement of the "&" by "%26" in the URLs in the first case.

#11 Updated by johan sanders over 3 years ago

legend is displayed in qgis version 2.15.0 revision 600ff4f !

in qgis version 2.14.3 it is not displayed !

#12 Updated by Giovanni Manghi over 3 years ago

  • Status changed from Open to Feedback

How is the situation in 2.16? it could have been solved and today also backported to 2.14.

#13 Updated by Stefan Blumentrath over 3 years ago

In 2.16.1 on OSGeo4W (64bit)
http://wms.reindrift.no? does not show a legend either.
It says: "Error downloading http://wms.reindrift.no?language=nor&version=1."

While it should show e.g. this:
http://wms.reindrift.no/?sld_version=1.1.0&version=1.3.0&service=WMS&request=GetLegendGraphic&format=image/png&layer=REINDRIFT

The server behind the WMS is Mapserver 7.0.1.

#14 Updated by Filip Mahieu over 3 years ago

As I can see, in QGis 2.14.7 it is resolved using the WMS Kay Warrie gave. I use a lot of WMS'es from the Flemish Government and they now all seem fine.

For my part, the issue can be closed.

#15 Updated by Giovanni Manghi about 3 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed/implemented

Also available in: Atom PDF