Skip to content

Commit

Permalink
Merge pull request qgis#56734 from mhugent/external_wms_filter_parameter
Browse files Browse the repository at this point in the history
Send filter parameter in wms client if contained in url
  • Loading branch information
mhugent authored Mar 27, 2024
2 parents 66c716d + 9763118 commit 8fd9166
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/providers/wms/qgswmscapabilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ bool QgsWmsSettings::parseUri( const QString &uriString )
}
}

if ( uri.hasParam( QStringLiteral( "filter" ) ) )
{
mFilter = uri.param( QStringLiteral( "filter" ) );
}

mImageMimeType = uri.param( QStringLiteral( "format" ) );
QgsDebugMsgLevel( "Setting image encoding to " + mImageMimeType + '.', 2 );

Expand Down
2 changes: 2 additions & 0 deletions src/providers/wms/qgswmscapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,8 @@ class QgsWmsSettings
bool mSmoothPixmapTransform;
enum QgsWmsDpiMode mDpiMode;

QString mFilter;

/**
* Active sublayers managed by this provider in a draw function, in order from bottom to top
* (some may not be visible in a draw function, cf. activeSubLayerVisibility)
Expand Down
5 changes: 5 additions & 0 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,11 @@ QUrl QgsWmsProvider::createRequestUrlWMS( const QgsRectangle &viewExtent, int pi
setQueryItem( query, QStringLiteral( "OPACITIES" ), mSettings.mOpacities.join( ',' ) );
}

if ( !mSettings.mFilter.isEmpty() )
{
setQueryItem( query, QStringLiteral( "FILTER" ), mSettings.mFilter );
}

// For WMS-T layers
if ( temporalCapabilities() &&
temporalCapabilities()->hasTemporalCapabilities() )
Expand Down

0 comments on commit 8fd9166

Please sign in to comment.