Bug report #9082

Failure to display getfeatureinfo results from mapserver 5.6

Added by landry Landry Breuil almost 6 years ago. Updated almost 6 years ago.

Status:Closed
Priority:Normal
Assignee:-
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

Description

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:

/ign?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=643017.590268,6464940.173196,779227.869222,6634377.228695&CRS=EPSG:2154&WIDTH=549&HEIGHT=682&LAYERS=bdforet_v2&STYLES=&FORMAT=image/png&QUERY_LAYERS=bdforet_v2&INFO_FORMAT=text/plain&I=158&J=66

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:

/ign?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=547703.2334924228489399,6460485.97326656896620989,874542.22599715110845864,6638618.47882782761007547&CRS=EPSG:2154&WIDTH=1244&HEIGHT=678&LAYERS=bdforet_v2&STYLES=&FORMAT=image/png&QUERY_LAYERS=bdforet_v2&INFO_FORMAT=application/vnd.ogc.gml&I=512&J=79&FEATURE_COUNT=10

Corresponding output:

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

<msGMLOutput 
     xmlns:gml="http://www.opengis.net/gml" 
     xmlns:xlink="http://www.w3.org/1999/xlink" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <bdforet_v2_layer>
        <bdforet_v2_feature>
            <gml:boundedBy>
                <gml:Box srsName="EPSG:2154">
                    <gml:coordinates>677318.603200,6616676.651300 684355.000000,6622735.000000</gml:coordinates>
                </gml:Box>
            </gml:boundedBy>
            <Shape_Leng>62147.67921460000</Shape_Leng>
            <Shape_Area>16737545.9377999994</Shape_Area>
            <TFV>FF1G01-01</TFV>
        </bdforet_v2_feature>
    </bdforet_v2_layer>
</msGMLOutput>

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 almost 6 years ago

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

History

#1 Updated by Giovanni Manghi almost 6 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 almost 6 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 almost 6 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"?>

<msGMLOutput 
         xmlns:gml="http://www.opengis.net/gml" 
         xmlns:xlink="http://www.w3.org/1999/xlink" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <cr_layer>
                <cr_feature>
                        <gml:boundedBy>
                                <gml:Box srsName="EPSG:4326">
                                        <gml:coordinates>12.095969,48.554099 18.863547,51.056235</gml:coordinates>
                                </gml:Box>
                        </gml:boundedBy>
                        <cat>1</cat>
                        <nazev>�esk� republika</nazev>
                        <nazev_a>Ceska republika</nazev_a>
                </cr_feature>
        </cr_layer>
</msGMLOutput>

#4 Updated by Jukka Rahkonen almost 6 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 almost 6 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 almost 6 years ago

  • Status changed from Feedback to Closed

#7 Updated by Radim Blazek almost 6 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