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

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

Guide to web service versions and version support in GIS applications

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

QGIS Project website

LINZ Data Importer QGIS plugin

Grab the LINZ Data Importer QGIS plugin for easy access to all WFS supported data from the LINZ Data Service in QGIS.

LINZ Data Importer plugin

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 3.4.11.

Tip: Setting a limit on your WFS request

Some LDS datasets (for example, 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 does not draw at small scales. You can set a scale dependency from the Layer > Properties > Rendering menu.

You can also create a custom filter to limit the WFS request, for example, by feature type or bounding box extent. More nformation about these filtering options are on our page about WFS filtering.

  1. From the QGIS application, Layer > Add Layer click the Add WFS Layer (globe icon) to bring up the Add layer window: 
     
     
  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) dataset.
    NZ Place Names (NZGB)
     
    Click OK (There is no need to enter a username and password as the LINZ Data Service knows you’re a registered user from your API key):

    Note: For large datasets you may want to enable feature paging. This periodically returns the data in pages; each page includes a specified number of features (e.g. 5,000 features per page). We recommend that you set the page size to no more than 10,000 features.  

     

  4. Now that you have 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:
     
  5. Find the layer you want in the layer list that is returned from the LINZ Data Service. Highlight it and click Add to add it to your map
     

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, Web feature services
Last Updated: 
16 March 2021