Skip to content

Commit

Permalink
WMS GetLegendGraphic fix #15055
Browse files Browse the repository at this point in the history
See http://hub.qgis.org/issues/15055

When creating the legend image url, this tests for available queryparams
in a case-insensitive way...
  • Loading branch information
rduivenvoorde authored and m-kuhn committed Jun 26, 2016
1 parent a5392fb commit 9bdfa67
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -2952,19 +2952,25 @@ QUrl QgsWmsProvider::getLegendGraphicFullURL( double scale, const QgsRectangle&


QUrl url( lurl ); QUrl url( lurl );


if ( !url.hasQueryItem( "SERVICE" ) ) // query names are NOT case-sensitive, so make an uppercase list for proper comparison
QStringList qnames = QStringList();
for ( int i = 0; i < url.queryItems().size(); i++ )
{
qnames << url.queryItems().at( i ).first.toUpper();
}
if ( !qnames.contains( "SERVICE" ) )
setQueryItem( url, "SERVICE", "WMS" ); setQueryItem( url, "SERVICE", "WMS" );
if ( !url.hasQueryItem( "VERSION" ) ) if ( !qnames.contains( "VERSION" ) )
setQueryItem( url, "VERSION", mCaps.mCapabilities.version ); setQueryItem( url, "VERSION", mCaps.mCapabilities.version );
if ( !url.hasQueryItem( "SLD_VERSION" ) ) if ( !qnames.contains( "SLD_VERSION" ) )
setQueryItem( url, "SLD_VERSION", "1.1.0" ); // can not determine SLD_VERSION setQueryItem( url, "SLD_VERSION", "1.1.0" ); // can not determine SLD_VERSION
if ( !url.hasQueryItem( "REQUEST" ) ) if ( !qnames.contains( "REQUEST" ) )
setQueryItem( url, "REQUEST", "GetLegendGraphic" ); setQueryItem( url, "REQUEST", "GetLegendGraphic" );
if ( !url.hasQueryItem( "FORMAT" ) ) if ( !qnames.contains( "FORMAT" ) )
setFormatQueryItem( url ); setFormatQueryItem( url );
if ( !url.hasQueryItem( "LAYER" ) ) if ( !qnames.contains( "LAYER" ) )
setQueryItem( url, "LAYER", mSettings.mActiveSubLayers[0] ); setQueryItem( url, "LAYER", mSettings.mActiveSubLayers[0] );
if ( !url.hasQueryItem( "STYLE" ) ) if ( !qnames.contains( "STYLE" ) )
setQueryItem( url, "STYLE", mSettings.mActiveSubStyles[0] ); setQueryItem( url, "STYLE", mSettings.mActiveSubStyles[0] );


// add config parameter related to resolution // add config parameter related to resolution
Expand Down

0 comments on commit 9bdfa67

Please sign in to comment.