4

When using a WMS service providing the following GetFeatureInfo capabilities:

enter image description here

Why does QGIS (3.32.3-Lima at the time of writing) only offer two formats (text/xml; subtype=gml/3.2.1 and text/plain) amongst all those provided by the server ?

enter image description here

0

2 Answers 2

4

The WMS Provider qgswmscapabilities.cpp loops through the supported GetFeatureInfo formats and categorises them into "text", "html" and "feature" types.

I think (but am not sure) that the last GetFeatureInfo format of each type in the loop is used (because they are inserted not appended).

4

Probably only the one who has coded the QGIS WMS provider can tell for sure but we may try to guess. The code is at https://github.com/qgis/QGIS/blob/06b5c5112726b9d29a35fdc5d4bb0e428cf25061/src/providers/wms/qgswmsprovider.cpp

The WMS standard does not define accurately what the GetFeatureInfo operation should return. The whole operation is optional. If server supports GFI then this applies:

7.4.3.5 INFO_FORMAT The mandatory INFO_FORMAT parameter indicates what format to use when returning the feature information. Supported values for a GetFeatureInfo request on a WMS server are listed as MIME types in one or more elements of its service metadata. The entire MIME type string in is used as the value of the INFO_FORMAT parameter. In an HTTP environment, the MIME type shall be set on the returned object using the Content-type entity header. If the request specifies a format not supported by the server, the server shall issue a service exception (code = InvalidFormat). EXAMPLE The parameter INFO_FORMAT=text/xml requests that the feature information be formatted in XML.

What the server should return within the response is left open

The actual semantics of how a WMS decides what to return more information about, or what exactly to return, are left up to the WMS provider.

The GetFeatureInfo responses can be categorized into two classes:

  • response contains only attribute data
  • response contains attributes and geometries of the queried features

The geometry options allows some nice options for the WMS client - for example highlight the borders of the clicked polygon - but by the same it opens a possibility to harvest the source data from the WMS server by making subsequent GetFeatureInfo requests. Therefore the feature option is often disabled even if the WMS server might technically support it.

So, there are two main options: only attributes or attributes with geometry. QGIS supports those two in the user interface. Because the WMS standard does not define any outputformat then the coder must study which formats might work. Most WMS servers support text/plain for the attributes even the standard does not mandate it. The situation of the feature option is more fuzzy but developer can have a look at what GeoServers typically support https://docs.geoserver.org/2.23.x/en/user/services/wms/reference.html, or ArcGIS Server https://webhelp.esri.com/arcims/9.3/General/mergedProjects/wms_connect/wms_connector/get_featureinfo.htm.

By reading the code of the QGIS WMS provider it seems that QGIS is analyzing the list of supported info formats from the GetCapabilities and selects the first (or last?) format that contains geometries for the "Feature" option.

EDIT

@user2856 is right, QGIS has three categories for showing the GetFeatureInfo responses: HTML, Text, and Feature. The referenced server does not support the HTML option and therefore it does not appear in the drop down menu. I made a test with a default GeoServer installation and then I had three options in the menu.

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.