Skip to content
Permalink
Browse files

WMS GetLegendGraphic fix #15055 (#3213)

When creating the legend image url, this tests for available queryparams
in a case-insensitive way...
  • Loading branch information
rduivenvoorde authored and NathanW2 committed Jun 21, 2016
1 parent 3e1971b commit 543d5211332a885960a19b4a7ca7ff3296838a27
Showing with 13 additions and 7 deletions.
  1. +13 −7 src/providers/wms/qgswmsprovider.cpp
@@ -2990,19 +2990,25 @@ QUrl QgsWmsProvider::getLegendGraphicFullURL( double scale, const QgsRectangle&

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" );
if ( !url.hasQueryItem( "VERSION" ) )
if ( !qnames.contains( "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
if ( !url.hasQueryItem( "REQUEST" ) )
if ( !qnames.contains( "REQUEST" ) )
setQueryItem( url, "REQUEST", "GetLegendGraphic" );
if ( !url.hasQueryItem( "FORMAT" ) )
if ( !qnames.contains( "FORMAT" ) )
setFormatQueryItem( url );
if ( !url.hasQueryItem( "LAYER" ) )
if ( !qnames.contains( "LAYER" ) )
setQueryItem( url, "LAYER", mSettings.mActiveSubLayers[0] );
if ( !url.hasQueryItem( "STYLE" ) )
if ( !qnames.contains( "STYLE" ) )
setQueryItem( url, "STYLE", mSettings.mActiveSubStyles[0] );

// add config parameter related to resolution

0 comments on commit 543d521

Please sign in to comment.
You can’t perform that action at this time.