Skip to content

Commit

Permalink
WMS GetLegendGraphic fix #15055 (#3213)
Browse files Browse the repository at this point in the history
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 543d521
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 543d521

Please sign in to comment.