Bug report #9082

Failure to display getfeatureinfo results from mapserver 5.6

Added by landry Landry Breuil over 10 years ago. Updated over 10 years ago.

Category:Web Services clients/WMS
Affected QGIS version:2.0.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17727


Tried on OpenBSD and Windows 7, with QGIS 2.0.1. (1.8.0 works fine but queries INFO_FORMAT=text/plain)

If i query a wms layer via getfeatureinfo, qgis says 'no entity found on that position' while the received XML actually contains a 'valid' geometry+attrs - serverside is mapserver 5.6.5.

Query made by 1.8:


Corresponding output:
GetFeatureInfo results:

Layer 'bdforet_v2'
  Feature 38: 
    Shape_Leng = '62147.67921460000'
    Shape_Area = '16737545.9377999994'
    TFV = 'FF1G01-01'

Query made by 2.0.1:


Corresponding output:

<?xml version="1.0" encoding="ISO-8859-15"?>

                <gml:Box srsName="EPSG:2154">
                    <gml:coordinates>677318.603200,6616676.651300 684355.000000,6622735.000000</gml:coordinates>

I know that 'msGMLOutput' might not be valid spec-wise, but this is what mapserver outputs here.. so it's a pretty bad regression from qgis 1.8.0.
Is there a way to manually force INFO_FORMAT back to text/plain ?

Associated revisions

Revision 9d17f255
Added by Radim Blazek over 10 years ago

Convert WMS GetFeatureInfo GML to UTF-8 supported by Expat, fixes #9082


#1 Updated by Giovanni Manghi over 10 years ago

  • Status changed from Open to Feedback
  • Target version set to Future Release - High Priority

Radim, as you worked on this matters recently, can you add a comment? this should be fixed in master, right?

Landry, can you test on master?

#2 Updated by Radim Blazek over 10 years ago

'msGMLOutput' is OK. I don't see anything wrong in the response.

Current master can display parsing error with possibility to switch the format. I am not sure if the problem is parsing error (does not seem to be) or something else.

Can you give us a public URL?

If you can configure the server just disable xml/gml format as temporal workaround.

#3 Updated by Radim Blazek over 10 years ago

Here is an example of what works for me both in 2.0.1 and current master:

<?xml version="1.0" encoding="ISO-8859-1"?>

                                <gml:Box srsName="EPSG:4326">
                                        <gml:coordinates>12.095969,48.554099 18.863547,51.056235</gml:coordinates>
                        <nazev>�esk� republika</nazev>
                        <nazev_a>Ceska republika</nazev_a>

#4 Updated by Jukka Rahkonen over 10 years ago

Why not to make InfoFormat selectable in the WMS server settings? As Mapserver administrator I know it is very hard to make all possible clients happy with all text/plain, text/html and GML GetFeatureInfo formats.

#5 Updated by Radim Blazek over 10 years ago

Jukka Rahkonen wrote:

Why not to make InfoFormat selectable in the WMS server settings?

It could be useful but the query format is not part of datasource URI, it is set on layer as customProperty. At this moment, there is no API to pass such additional params in addRasterLayer() method. We should add customProperty editor to layer properties.

The idea behind the format selectable in results window was:
  • don't ask user to have to set something until he needs that
  • keep the option close to where it is used

QgsGmlSchema::guessSchema() fails with your response giving: "unknown encoding", try to change wms_encoding to "ISO-8859-1" and it should work.
The problem is described here: http://sourceforge.net/p/expat/bugs/498/
Fix to do in QGIS: check response encoding and convert it to UTF-8.

In master (will become 2.2), in case of problems with parsing response you get dialog where you can switch format.

#6 Updated by Radim Blazek over 10 years ago

  • Status changed from Feedback to Closed

#7 Updated by Radim Blazek over 10 years ago

I added conversion to UTF-8 to WMS provider.

We should make QgsGmlSchema and QgsGml to support any encoding, probably throwing Expat and using QXml*?

Also available in: Atom PDF