Bug report #17282

Legend image for root group of WMS service

Added by dr - over 6 years ago. Updated about 5 years ago.

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

Description

If open root group of WMS service then legend image only for one layer will be displayed at table of contents.

wms_tree.png (11.7 KB) dr -, 2017-10-15 04:17 PM

History

#1 Updated by Giovanni Manghi over 6 years ago

  • Affected QGIS version changed from master to 2.18.13

#2 Updated by Richard Duivenvoorde over 6 years ago

I had a look into this, and the crux is that selecting the 'root' of the layer tree is interpreted by QGIS as requesting the layer width the 'default' style (that is: in the url you send you get an empty 'style' parameter: ...&STYLES=&LAYERS=...

BUT according to the OGC WMS spec:
"If only a single style is available, that style is known as the “default” style"...
and
"If the server advertises several styles for a layer, and the client sends a request for the default style, the choice of
which style to use as default is at the discretion of the server. The ordering of styles in the service metadata does
not indicate which is the default."

And caveat: from the capabilities document of a WMS you can not make up WHAT the default style is in case there are more styles available. Another problem: there could be more styles available then advertized, as the style is actually cascading...

So in the code of QGIS
see: https://github.com/qgis/QGIS/blob/master/src/providers/wms/qgswmsprovider.cpp#L285
you only get a valid legend url when:
1) there is just ONE style available (of which QGIS then rightfully concludes that THAT is the default style)
2) you request one of the named styles
3) (QGIS special): if you name one of the styles as 'default'

So in this case we cannot do anything (I think). Picking the first style for the legend in case of more style could be wrong (as it is not defined as the default style). So I think QGIS does what it can do.

IF you are managing the WMS yourself, you could name the style 'default', but you get into trouble off course when you have more several layers for which you want do define different 'defaults'.

IF there would be a OGC WMS 1.3.1 it would be nice if one of the styles would be advertised as 'default'.

#3 Updated by Giovanni Manghi over 6 years ago

  • Status changed from Open to Feedback

#4 Updated by Jürgen Fischer over 5 years ago

Please test with QGIS 3.4 - QGIS 2.18 reached it's end of life.

#5 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Feedback to Closed

End of life notice: QGIS 2.18 LTR

Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/

QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.

We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4

Most plugins have been either migrated or incorporated into the core QGIS code base.

We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.

You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.

If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.

The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.

Also available in: Atom PDF