I'd like to add a WMS layer through my QGIS plugin with custom CQL_FILTER parameters. My problem is, that the CQL_FILTER parameters are not passed to the GeoServer (I can see it in the GeoServer log at the GetMap query: "CQLFilter = null").
This is what I've tried:
registry = QgsMapLayerRegistry.instance()
urlWithParams = "cql_filter=BBOX(geom, 579465,125671,664692,167717)&crs=EPSG:23700&featureCount=10&format=image/png&layers=master&styles=&url=http://localhost:9090/geoserver/myWorkspace/wms"
rlayer = QgsRasterLayer (urlWithParams , "my_title", "wms")
registry.addMapLayer(rlayer)
The WMS layer is added to the map with no problem, but all the features are visible on the layer even outside the BBOX I defined in the parameters. When I use the GeoServer's built-in CQL_FILTER builder (with the layer preview) the same filter works as desired.
Does anyone have a solution or a workaround for this?
I use QGIS 2.4.0-Chugiak.