qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.5k stars 2.99k forks source link

WMS title and abstract is not displayed for WMS provided by QGIS Server #40736

Closed pathmapper closed 3 years ago

pathmapper commented 3 years ago

Describe the bug WMS title is not displayed in QGIS browser for WMS provided by QGIS Server.

How to Reproduce

  1. Create a new WMS connection using the URL: http://168.119.115.196/cgi-bin/missing_title/qgis_mapserv.fcgi
  2. Open the connection in QGIS browser
  3. See error --> Title is not displayed:

Using a browser to request the GetCapabilities document, the title is there: http://168.119.115.196/cgi-bin/missing_title/qgis_mapserv.fcgi?service=WMS&version=1.3.0&request=GetCapabilities

QGIS and OS versions

QGIS version 3.16.2-Hannover QGIS code revision f1660f9da5
Compiled against Qt 5.11.3 Running against Qt 5.11.3
Compiled against GDAL/OGR 2.4.0 Running against GDAL/OGR 2.4.0
Compiled against GEOS 3.7.1-CAPI-1.11.1 Running against GEOS 3.7.1-CAPI-1.11.1 27a5e771
Compiled against SQLite 3.27.2 Running against SQLite 3.27.2
PostgreSQL Client Version 11.9 (Debian 11.9-0+deb10u1) SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.10.4
Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018
OS Version Debian GNU/Linux 10 (buster)
Active python plugins ClipMultipleLayers; quick_map_services; scriptrunner3; LAStools; canvas_clipper; savedialog; loadthemall; clipper; kmltools; qgis-maptiler-plugin; MapsPrinter; Discovery; mmqgis; pluginbuilder3; vector_tiles_reader; layerGroupFilter; plugin_reloader; realcentroid; mask; QuickOSM; MetaSearch; db_manager; processing

Additional context

project_and_data_used_for_qgis_server.zip


For other WMS the title is displayed in QGIS browser, e.g.: https://www.wms.nrw.de/geobasis/wms_nw_dop

https://www.wms.nrw.de/geobasis/wms_nw_dop?service=WMS&version=1.3.0&request=GetCapabilities

gioman commented 3 years ago

It is not a Browser only issue, "title" and "abstract" also do not show in the "add WMS layer" dialog when establishing a connection.

pathmapper commented 3 years ago

Good find @gioman, added also Abstract and Short name to the sample project:

sample_project_title_abstract.zip

http://168.119.115.196/cgi-bin/missing_title/qgis_mapserv.fcgi?service=WMS&version=1.3.0&request=GetCapabilities

grafik


Short name is displayed in the "add WMS layer" dialogue where Title and Abstract are missing:

Also tried the sample QGIS Server WMS using another GIS software and the Abstract and Title are displayed:

grafik

Summary

software title abstract
QGIS Desktop 3.16.2 :x: :x:
Firefox Browser (getCapabilities) :heavy_check_mark: :heavy_check_mark:
another GIS software :heavy_check_mark: :heavy_check_mark:
pathmapper commented 3 years ago

After taking a closer look at the OpenGIS Web Map Service (WMS) Implementation Specification it's getting clearer what's happening here:

  1. QGIS Desktop doesn't show Title and Abstract of the <Service> element (spec 7.2.4.3. General service metadata) for QGIS Browser and the "add WMS layer" dialogue at all. Instead it is showing Title and Abstract of the available layers including parent layers. Regarding parent layers, from spec 7.2.4.5 (Layers and styles):

    Each available map is advertised by a element in the service metadata. Conceptually, each Layer is a distinct entity. However, as a means of classifying and organizing layers, and as a means of reducing the size of the service metadata, a single parent Layer may enclose any number of additional layers, which may be hierarchically nested as desired.

Looks like in the project properties the term root layer is used instead of parent layer (for the Short name field).

2. QGIS Server adds a parent/root layer using the Short name field of the project properties for <Name>, but it doesn't include <Title> and <Abstract> for this parent/root layer for getCapabilities and there's no way to set them in the project properties.

Spec 7.2.4.6.2

A <Title> is mandatory for all layers

Spec 7.2.4.6.4

The optional <Abstract> and <KeywordList> elements are optional, but a server should provide them.

A solution here might be to use Title and Abstract defined in Service Capabilities also for <Title> and <Abstract> of the parent/root layer.