I'm trying to use PyQgis to query a WFS-service and return the items found within a certain bounding box.
When entering the following uri in the browser, it returns a xml with a limited set of results
uri = 'https://geoservices.informatievlaanderen.be/overdrachtdiensten/GRB/wfs?request=getFeature&srsname=EPSG:31370&typename=GRB:ADP&BBOX=183918,186419,184189,186632,EPSG:31370'
Using PyQgis I wish to load this into QGIS (3.4.3):
layer = QgsVectorLayer(uri, "WFS_Layer", "WFS") print(layer.isValid()) project = QgsProject.instance() project.addMapLayer(layer)
The layer which loads, loads all the data within my view extent, not just the data I requested in BBOX. Afterwards I need to get some attributes of the loaded data, therefor I wish to limit the amount of data, as loading times easily get too high.
Is this a bug or am I doing something wrong?
Reading the link below, I think it's a chosen behaviour in the Qgis implementation. Is there any way to circumvent this? https://issues.qgis.org/issues/8871
I also tried the solution provided in the question below, but had no luck. Why doesn't QGIS show the results from a WFS BBOX from a Python script