Bug report #10413

non-cached WFS won't load

Added by Neil Benny almost 10 years ago. Updated over 9 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Jürgen Fischer
Category:Web Services clients/WFS
Affected QGIS version:master Regression?:No
Operating System:Windows 7 32bit Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:18829

Description

Looking at the nightly build version 2.3 (2/6/2014) there seems to be an issue with the way QGIS handles non-cached WFS data.

Load the following public WFS: http://www.osmgb.org.uk/ogc/wfs-vmd

Add any of the items (tested on roads, railways, surface water), untick the "Cache" button.

The layer isn't being called and is not loading.

This works in the current standard version (2.2)

28.png (674 KB) Richard Duivenvoorde, 2014-06-15 11:46 PM


Related issues

Related to QGIS Application - Bug report #11062: Manipulating a cached WFS layer causes application crash Closed 2014-08-15
Related to QGIS Application - Bug report #10890: Unable to add non-cached WFS layer through Python API Closed 2014-07-15

Associated revisions

Revision 945be40a
Added by Jürgen Fischer almost 10 years ago

wfs provider: make wfs non-cached mode work (fixes #10413)
TODO: refactoring

History

#1 Updated by Jürgen Fischer almost 10 years ago

  • Assignee set to Jürgen Fischer

#2 Updated by Richard Duivenvoorde almost 10 years ago

Confirmed here on Linux.

You can try using this wfs url:
http://geodata.nationaalgeoregister.nl/bag/wfs

( for some context, use this old wms: http://gdsc.nlr.nl/wms/dkln2006 )

try layer 'panden' == houses
note this is a service for whole NL (epsg:28992) serving a max of 15000 features.

WITH caching it returns those features scattered over Holland.
WITHOUT caching nothing is shown while the url used returns gml:

http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096

some debug info:

src/providers/wfs/qgswfssourceselect.cpp: 551: (treeWidgetCurrentRowChanged) treeWidget_currentRowChanged called
src/providers/wfs/qgswfssourceselect.cpp: 473: (changeCRSFilter) changeCRSFilter called
src/providers/wfs/qgswfssourceselect.cpp: 479: (changeCRSFilter) the current typename is: bag:pand
src/core/qgscoordinatereferencesystem.cpp: 992: (setMapUnits) Projection has linear units of metre
src/core/qgsowsconnection.cpp: 42: (QgsOWSConnection) theConnName = BAG wfs2
src/core/qgsowsconnection.cpp: 90: (QgsOWSConnection) Connection info: 'http://geodata.nationaalgeoregister.nl/bag/wfs'.
src/providers/wfs/qgswfscapabilities.cpp: 34: (QgsWFSCapabilities) theUri = url=http://geodata.nationaalgeoregister.nl/bag/wfs
src/providers/wfs/qgswfscapabilities.cpp: 37: (QgsWFSCapabilities) mBaseUrl = http://geodata.nationaalgeoregister.nl/bag/wfs?
src/core/qgscoordinatereferencesystem.cpp: 992: (setMapUnits) Projection has linear units of metre
src/providers/wfs/qgswfssourceselect.cpp: 405: (addLayer) Layer bag:pand Filter is 
src/providers/wfs/qgswfscapabilities.cpp: 144: (uriGetFeature) http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096
src/app/qgisapp.cpp: 7530: (addVectorLayer) Creating new vector layer using http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096 with baseName of bag:pand and providerKey of WFS
src/core/qgsmaplayer.cpp: 60: (QgsMapLayer) original name: 'bag:pand'
src/core/qgsmaplayer.cpp: 62: (QgsMapLayer) display name: 'bag:pand'
src/core/qgsproviderregistry.cpp: 348: (provider) Library name is /home/richard/apps/qgis/master/debug/lib/qgis/plugins/libwfsprovider.so
src/core/qgscoordinatereferencesystem.cpp: 397: (loadFromDb) failed : select srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name||':'||auth_id,is_geo from tbl_srs where srid='0' order by deprecated
src/core/qgscoordinatereferencesystem.cpp: 992: (setMapUnits) Projection has linear units of metre
src/core/qgsnetworkaccessmanager.cpp: 84: (queryProxy) using fallback proxy for http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&TYPENAME=bag:pand&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096&REQUEST=DescribeFeatureType
src/providers/wfs/qgswfsprovider.cpp: 1604: (geomTypeFromPropertyType) DescribeFeatureType geometry attribute "geometrie" type is "MultiPolygon" 
src/core/qgsnetworkaccessmanager.cpp: 84: (queryProxy) using fallback proxy for http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096
src/core/qgsproviderregistry.cpp: 370: (provider) Instantiated the data provider plugin: WFS
src/core/qgsvectorlayer.cpp: 1351: (setDataProvider) Instantiated the data provider plugin
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field gid of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field identificatie of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field bouwjaar of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field status of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field gebruiksdoel of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field oppervlakte_min of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field oppervlakte_max of 8 total
src/core/qgsvectorlayer.cpp: 274: (setDisplayField) Checking field aantal_verblijfsobjecten of 8 total
src/core/qgsvectorlayer.cpp: 2478: (setCoordinateSystem) ----- Computing Coordinate System
src/core/qgsdatasourceuri.cpp: 243: (QgsDataSourceURI) invalid connection option "http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE" ignored
src/core/qgsmaplayer.cpp: 911: (loadNamedStyle) uri = http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096 myURI = http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096
src/core/qgsmaplayer.cpp: 933: (loadNamedStyle) project fileName: /home/richard
src/core/qgsmaplayer.cpp: 867: (loadNamedStyleFromDb) db = /home/richard/.qgis2//qgis.qmldb uri = http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096
src/core/qgsmaplayer.cpp: 877: (loadNamedStyleFromDb) Trying to load style for "http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096" from "/home/richard/.qgis2//qgis.qmldb" 
src/core/qgsmaplayer.cpp: 867: (loadNamedStyleFromDb) db = /home/richard/apps/qgis/master/debug/share/qgis/resources/qgis.qmldb uri = http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096
src/core/qgsmaplayer.cpp: 877: (loadNamedStyleFromDb) Trying to load style for "http://geodata.nationaalgeoregister.nl/bag/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=bag:pand&SRSNAME=EPSG:28992&BBOX=104629.20637482314486988,490097.08506930683506653,104779.20637482320307754,490278.90968033944955096" from "/home/richard/apps/qgis/master/debug/share/qgis/resources/qgis.qmldb" 
src/app/qgisapp.cpp: 7538: (addVectorLayer) got valid layer with 0 sublayers
src/gui/qgsmapcanvas.cpp: 599: (refresh) CANVAS render flag off
src/gui/qgsmapcanvas.cpp: 611: (refresh) CANVAS refresh scheduling
src/providers/wfs/qgswfssourceselect.cpp: 104: (~QgsWFSSourceSelect) saving settings
src/gui/qgsmapcanvas.cpp: 392: (setLayerSet) Layers changed to: bag_pand20140613055221349, brtachtergrondkaart20140613054756032

#3 Updated by Jürgen Fischer almost 10 years ago

  • Status changed from Open to Closed

#4 Updated by Richard Duivenvoorde almost 10 years ago

  • File 28.png added
  • Status changed from Closed to Reopened

Testing with the wfs above.

While I think the non-cached version is now working, to me the cached version isn't working anymore.

Another issue is that if I load the same layer cached and non-cached, and try to remove them both by selecting them in de layermanager and ctrl-D QGIS crashes.

The cached version either shows nothing to me, OR just a few house (on the attached screendump green is now non-cached while the few red houses on top is exact the same layer but cached

is it working with you?

#5 Updated by Jürgen Fischer almost 10 years ago

Richard Duivenvoorde wrote:

Testing with the wfs above.

While I think the non-cached version is now working, to me the cached version isn't working anymore.

Another issue is that if I load the same layer cached and non-cached, and try to remove them both by selecting them in de layermanager and ctrl-D QGIS crashes.

The cached version either shows nothing to me, OR just a few house (on the attached screendump green is now non-cached while the few red houses on top is exact the same layer but cached

is it working with you?

Depends how you think it should work. The cached mode loads the full layer and the non-cached mode loads the canvas (and more if you pan). Apparently the service limits the output 15000 and in cached mode you end up with a layer of 15000 cached features, while in non-cached mode you get everything from the canvas (as long as its less or equal 15000).

#6 Updated by Richard Duivenvoorde almost 10 years ago

  • Status changed from Reopened to Closed

oops, yes. I know this.... I even wrote a blog about it... http://www.qgis.nl/2013/04/29/qgis-en-wfs-caching/

will close this issue again then....

#7 Updated by Neil Benny almost 10 years ago

  • Status changed from Closed to Reopened
  • Target version changed from Version 2.4 to Future Release - High Priority

Although the original issue is resolved I am now experiencing the same problem when adding a WFS layer using the Python API.

Adding a WFS layer (with iface.addVectorLayer) works without any problems when adding a cached WFS to the map canvas. However, using the BBOX parameter in the vector layer path will again add the layer to the TOC but no features are shown.

I am experiencing this problem in 2.4 and nightly build (30/06/2014).

#8 Updated by Richard Duivenvoorde almost 10 years ago

can you please add the python code you are using?

Because I think this is/should contain exact the same logic

- if you add a BBOX= to your uri, it will be non-cached (using a bbox query in the wfs requests).

have a look into this:
https://github.com/qgis/QGIS/blob/master/src/providers/wfs/qgswfsprovider.cpp#L123

try adding &BBOX=[yourmaxextent] and mCached will be set to true, and the bbox will be used

if not, I think it is worth opening a new issue, instead of making this one longer?

#9 Updated by Neil Benny almost 10 years ago

I can confirm I am using the BBOX parameter in the uri:

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')

printing url gives:
http://myurl.co.uk/data_services/wfs.ashx?id=lalalala~&SRSNAME=EPSG:27700&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=The_Layer_I_Want&BBOX=279661.8626045954297297,692934.9235554961487651,280059.7859282681602053,693175.8901554960757494

The code I am using was working OK in 2.2.

If you can confirm I'm not making any silly mistakes I will go ahead and open a new issue.

#10 Updated by Jürgen Fischer over 9 years ago

  • Status changed from Reopened to Closed

original issue resolved. New issue see #11062

#11 Updated by Neil Benny over 9 years ago

Also related to issue #10890 - this element of the bug has not been fixed.

Also available in: Atom PDF