[Qgis-developer] Problem adding non-cached WFS layer using PyQgis

mattwalsh matthew.walsh at thinkwhere.com
Thu Oct 16 01:48:28 PDT 2014


Hello,

>From my plugin I am able to add a non-cached WFS layer to QGIS using the
following code:

c_extent = self.canvas.extent()
str_c_extent = c_extent.toString()
str_c_extent = str_c_extent.replace(" : ", ",")
url = site_url + "wfs.ashx?id=" + token +
"&SRSNAME=EPSG:27700&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME="
+ layer + "&BBOX=" + str_c_extent
iface.addVectorLayer(url, title, 'WFS')

The layer is added to the ToC fine but does not fetch any features ('show
feature count' is 0). Panning the canvas etc does not cause the layer to
request features either. 

If I add the same layer in using QGIS GUI (unchecking the 'cache' button)
then each pan/refresh will request the features for the new canvas extent.

The layer source of the WFS added by PyQgis and QGIS GUI are identical when
looking at the properties.

I have tried this in both 2.4 and nightly build. This was not an issue in
2.2 with exactly the same code.

Could anyone suggest fix/work around to this problem I could try?

Manys thanks
Matt





--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Problem-adding-non-cached-WFS-layer-using-PyQgis-tp5167778.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list