Bug report #7650

WMS provider and XLink namespace definition

Added by Alexis Guéganno about 5 years ago. Updated about 1 year ago.

Category:Web Services clients/WMS
Affected QGIS version:master Regression?:No
Operating System:openSUSE 12.3 x86_64 - KDE 4.10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No


Hi !
I think I've caught a bug in QGIS related to the WMS getCapabilites management. In my getCapabilites document, I have the following GetMap section :

                <OnlineResource ns2:type="simple" ns2:href="http://services-redirect/wms/wms?" ns2:title="GetMap"/>

The XML namespace ns2 is defined in the XML document, as expected, and as follows :

<WMS_Capabilities xmlns="http://www.opengis.net/wms" xmlns:ns2="http://www.w3.org/1999/xlink">

When importing a layer from this WMS server from QGIS, I can't get a map to be drawn. The software tries to use the Onlineresource given in the getCapabilities document, as expected. However, it explicitly expects the namespace http://www.w3.org/1999/xlink to be named xlink in the document. In other words, I think we can't define namespaces freely in the getCapabilities if we want QGIS to be able to read it efficiently.

Having compiled QGIS in debug mode, I get that in the output :

Debug: src/providers/wms/qgswmsprovider.cpp: 668: (draw) getmap: ?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=303657.0135596171021461,2251980.2250325772911310,307049.3223884691833518,2254606.0406881999224424&CRS=EPSG:27572&WIDTH=930&HEIGHT=719&LAYERS=route_nantes_map&STYLES=&FORMAT=image/jpeg&DPI=87&MAP_RESOLUTION=87&FORMAT_OPTIONS=dpi:87
Debug: src/providers/wms/qgswmsprovider.cpp: 1539: (cacheReplyProgress) 0 sur 0 bytes de carte téléchargés.
Debug: src/core/qgsmessagelog.cpp: 45: (logMessage) 2013-04-19T11:55:25 WMS[1] Map request failed [error:Le protocole "" est inconnu url:?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=303657.0135596171021461,2251980.2250325772911310,307049.3223884691833518,2254606.0406881999224424&CRS=EPSG:27572&WIDTH=930&HEIGHT=719&LAYERS=route_nantes_map&STYLES=&FORMAT=image/jpeg&DPI=87&MAP_RESOLUTION=87&FORMAT_OPTIONS=dpi:87]

As you can see, the URL is not complete : we have the HTTP parameters, that's all...

The problematic code may be in src/providers/wms/qgswmsprovider.cpp. "xlink:href" is hard coded in the source file. As I don't think that the WMS specification forces WMS implementation to define xlink as the namespace alias for http://www.w3.org/1999/xlink (even if such a use makes sense), I think this is a bug in QGIS.

Bug discovered in 1.8.0. I've just compiled the master branch from github and still have the bug.

I've searched for a similar bug in the tracker's base and did not find one. I hope it's not a duplicate.


#1 Updated by Giovanni Manghi about 1 year ago

  • Easy fix? set to No
  • Regression? set to No

Also available in: Atom PDF