Using LDS WFS in QGIS

A step-by-step guide on connecting to LDS Web Feature Services (WFS) in QGIS.

Before you start, see our helpful guide to web service versions and version support in GIS applications to check which web services your version of QGIS supports.

Visit the QGIS Project website for more help and to download the application.

Accessing LDS web services

The first step in accessing LDS web services is to create a web services or API key. These keys are codes (such as, abcdefgh123456789) unique to each LDS user, and are used to simplify the process of accessing web service.

How to use LDS Web Feature Services (WFS) in QGIS

The following process for accessing LDS Web Feature Services in QGIS is performed using QGIS version 2.18.

Notes:
Some LDS datasets (eg the Primary Parcels dataset) are too big to load in QGIS without first setting a limit to restrict the number of features returned. Often, if you try to load large LDS datasets without first setting a limit you may encounter a HTTP 504 timeout error.

There are a few ways to set a limit within QGIS, including limiting the layer extents or by setting a maximum number of features that will be requested.

Scale dependent rendering can also be set on the WFS layer so it doesn’t draw at small scales. You can set a scale dependency from the Layer> Properties menu.

You can also create a custom filter to limit the WFS request, for example, by feature type or bounding box extent. You can find more information about these filtering options on our page about WFS related timeout errors.

  1. From the QGIS application, click the Add WFS Layer globe icon shown below to bring up the Add layer window:
    Screenshot of the 'Add WFS Layer' globe icon in QGIS

     
  2. Click New:

     
  3. Enter a name of your choosing in the Name field.

    Copy and paste the WFS URL from the ‘Services’ tab of your layer of choice in LDS into the URL field. For example, see the Services tab for the NZ Place Names (NZGB).


    Click OK (There’s no need to enter a username and password as the LINZ Data Service knows you’re a registered user from your API key):

    Note: If you choose “Auto-detect” or 2.0 in Version field, the Max. number of features box works as WFS paging. Leaving the box empty, page size returns to the LDS default setting which is 1.2 million. We recommend that you set the page size to no more than 10,000 features.
     
  4. Now that you’ve created a new connection under Server connections.

    Make sure you click on the Only request features overlapping the view extent checkbox. The option improves WFS performance by only requesting features in a bounding box. Click the Connect button:

    Screenshot highlighting 'Connect' button in the 'Add WFS Layer...' window

     
  5. Find the layer you want in the layer list that’s returned from the LINZ Data Service. Highlight it and click Add to add it to your map:
    Screenshot highlighting 'Add' button in the 'Add WFS Layer...' window

    Note: A SQL query can be added under the 'Sql' field in the window above before loading the layer from the LDS server. You can build the query in SQL query composer. The composer can be opened by double-clicking Sql field or clicking the Build query button in the window above. This is similar to a SQL query on a database. Our help on WFS related timeouts provides some example filters.

Reference Category: Web services
Reference Tags: QGIS
Last Updated: 
9 August 2018