QGIS and WFS service caching

The dutch PDOK-services plugin is a simple plugin to load some national (PDOK) dataservices.

One of the available services is a Web Features Service (WFS), while a very handy service, calling the WFS service to load all roads in the Netherlands shows you the following result:

As you can see the blue bar are actually all the (road) features that you receive. This (rather) strange result is also what you get when you zoomed in to a much smaller area. One would expect that the features would be retrieved only within current Extent/BoundingBox, but QGIS show exact the same ‘bar’ of features.

But we/QGIS can make this work…

It appears that the default way for QGIS to sent a WFS featureRequest is to sent it WITHOUT BoundingBox/Extent. Apperently the idea is that one can retrieve all features in one request. But in this case the total number of features is rather huge. Besides that, PDOK only sents you 15000 features at maximum. These will almost never be the features that you want, QGIS also caches all features for you, so on zooming in there will be no further requests anymore for other features.

But QGIS can use the extent, only not via the PDOK plugin, but using the normal ‘add WFS layer’ functionality.

This is the recipe:

– find out the service url of the WFS via the web or via a search in the CSW (Catalog Service for the Web) plugin.

– via the button ‘add WFS layer’ create a new service based on this url an click ‘connect’.

– QGIS now will get the capabilities of the service and show you the available layers for this service. See below:

– The magic now to retrieve only the features in your extent, is odo UNcheck the check in the column ‘Cache Features’. With this you instruct QGIS to not cache the features, and force QGIS to retrieve features whenever you pan or zoom out. (technicaly: the GetFeatureRequest now containts a BBOX-filter).

While (in our case) you still only retrieve the maximum of 15000 feature, these are at least the features into the area of interest :-)
Because these are real (vector) features you can style them, use the i-tool, copy them OR save them into another Vector format.

Now that we show you some roads, it’s also nice to show off some of the new labeling features of QGIS.

In QGIS 1.8, the labeling of lines and areas was rather simple. Though you had some influence in styling and placing of the labels, some more advanced labeling features lik ‘follow lines’ were not possible:

But in the current master version of QGIS, the upcoming 2.0 version there will be much more labeling features, so for example road labeling will look much better:

Have fun with WFS and QGIS.

2 thoughts on “QGIS and WFS service caching”

  1. Hoi,
    Labeling van hartlijnen: Je tweede screenshot, met de gebogen labels die de hartlijn volgen, kan ook al in QGIS 1.8 hoor… kies daarvoor “Labels” onder het menu “Kaartlagen” en kies voor “Geavanceerd->Plaatsing->Gebogen”.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>