Skip to content
Permalink
Browse files
wms: improve xsd/gml detection on getfeatureinfo
  • Loading branch information
jef-n committed Feb 10, 2013
1 parent a98ed43 commit d8952d337476e4b1c4746ec44ffd26824cd83a9e
Showing with 28 additions and 16 deletions.
  1. +28 −16 src/providers/wms/qgswmsprovider.cpp
@@ -4081,25 +4081,37 @@ QMap<int, QVariant> QgsWmsProvider::identify( const QgsPoint & thePoint, Identif

int gmlPart = -1;
int xsdPart = -1;
if ( mIdentifyResultBodies.size() == 1 )
for ( int i = 0; i < mIdentifyResultHeaders.size(); i++ )
{
QgsDebugMsg( "Simple GML" );
gmlPart = 0;
}
else if ( mIdentifyResultBodies.size() == 2 ) // GML+XSD
{
QgsDebugMsg( "Multipart with 2 parts - expected GML + XSD" );
// How to find which part is GML and which XSD? Both have
// Content-Type: application/binary
// different are Content-Disposition but it is not reliable.
// We could analyze beginning of bodies...
gmlPart = 0;
xsdPart = 1;
if ( xsdPart == -1 && mIdentifyResultHeaders[i].value( "Content-Disposition" ).contains( ".xsd" ) )
{
xsdPart = i;
}
else if ( gmlPart == -1 && mIdentifyResultHeaders[i].value( "Content-Disposition" ).contains( ".dat" ) )
{
gmlPart = i;
}

if ( gmlPart != -1 && xsdPart != -1 )
break;
}
else

if ( xsdPart == -1 && gmlPart == -1 )
{
QgsDebugMsg( QString( "%1 parts in multipart response not supported" ).arg( mIdentifyResultBodies.size() ) );
continue;
if ( mIdentifyResultBodies.size() == 1 ) // GML
{
gmlPart = 0;
}
if ( mIdentifyResultBodies.size() == 2 ) // GML+XSD
{
QgsDebugMsg( "Multipart with 2 parts - expected GML + XSD" );
// How to find which part is GML and which XSD? Both have
// Content-Type: application/binary
// different are Content-Disposition but it is not reliable.
// We could analyze beginning of bodies...
gmlPart = 0;
xsdPart = 1;
}
}

QgsDebugMsg( "GML (first 2000 bytes):\n" + QString::fromUtf8( mIdentifyResultBodies.value( gmlPart ).left( 2000 ) ) );

0 comments on commit d8952d3

Please sign in to comment.