I've created a layer in GeoServer. The layer is based on a SQL view and is parametrized as described in the documentation. I can access the WFS in the browser with a URL something like the below:


(Note the viewparams part at the end of the query string.)

But I don't see a way to set these parameters in QGIS when I'm adding the layer. I can connect successfully and find my layer in the list, but there doesn't seem to be a way to configure these parameters:

Add WFS Layer dialog

How can I set these parameters? Does the Build query functionality allow me to via some mechanism I'm not aware of?

  • You can try to create the WFS connection so that the base URL contains the view parameter http://localhost:8080/geoserver/wfs?VIEW_PARAM=my_param&. This may work if QGIS does not use the GetFeature URL that comes with the GetCapabilities. Even if it happens to work you can't make it dynamic but you must create a new connection for each VIEW_PARAM value that you will need.
    – user30184
    Aug 27, 2016 at 13:39
  • this is reported here: issues.qgis.org/issues/6354
    – Lennert
    Oct 19, 2018 at 8:34

1 Answer 1


with python 2.x in Qgis 2.14.x and 2.18.x, you can use params in url like this:

layer = QgsVectorLayer(uri, "layer_wfs_with_params", "WFS")
if not layer.isValid():
    print "Layer failed to load!"

in qgis 3.x, with python 3.x

import urllib
params ={
   # 'cql_filter':cql_filter,

layer= QgsVectorLayer(uri, 'layer_wfs_with_params',"WFS")
if not layer.isValid():
    print ("Layer failed to load!")


  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. A good answer should include not only what to do, but also how to do it. Please edit your answer to include an explanation about how to use your suggested solution, and what it does.
    – Midavalo
    May 24, 2017 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.