QGIS

Accessing OS Features API via QGIS

QGIS is an open GIS (Geospatial Information System) desktop application that allows you to display, interrogate, visualise and create geospatial information including from geo-centric APIs (for example, a WFS).

These instructions demonstrate how to integrate and apply the OS Features API into QGIS in order to produce a series of topography layers based on our latest OS MasterMap Topography layer data.

What you need?

circle-info

Software version

We used QGIS version 3.4. to create these instructions

Instructions

circle-exclamation

Editing existing connection details

1

Open a blank document in QGIS.

Uncheck the Render box in the bottom toolbar for now.

QGIS UI highlighting Render option
2

Open the Add WFS Layer window

Navigate to Layer > Add Layer > Add WFS Layer

QGIS UI showing Layer > Add Layer > Add WFS Layer...navigation option
3

Click New in Server Connections in the Data Source Manager | WFS dialog to configure a new connection

If you have previously connected to OS Features API using a WFS connection, you can ignore steps 3, 4 and 5 move on to step 6.

QGIS Data Source Manager | WFS dialog
QGIS Data Source Manager | WFS dialog
4

Set up a new connection using the Connection Details dialog

Add the service details for your new connection:

  • Name: Provide a name for the API. It is good practice to name your connections in a way that makes them instantly recognisable.

  • URL: Copy your OS Features API endpoint address from the OS Data Hub and paste it into this field. Your API Key is automatically added to the URL in the key parameter.

  • Authentication: You can ignore these options. It is not necessary to enter your username and password to use the service as all authentication is done through your OS Features API key.

  • Version: Click Detect to identify the WFS version number.

  • Max. number of features: Enter a value between 100 and 1000. Larger values allow for a greater number of map features but may result in a slow response.

    Page size: Enter a value between 100 and 1000. As a best practice, we recommend you start with limiting the number of features and page size to 100 to ensure a smooth service. This can be increased to a maximum of 1000 to allow for more features to be loaded at once.

  • Other fields: Leave the rest of the fields as they are.

QGIS Connection Details dialog

You are not required to provide styling, zoom or coordinate information in the URL. This will be added at a later stage by your GIS application.

QGIS saves your connection details. You can reuse this connection with any of your geospatial projects.

5

Connect to the WFS server in the Server Connections window of the Data Source Manager

  1. Select your connection to the OS Features API in the dropdown. If you called the OS Features API before, the connection will be available as an option in the dropdown.

  2. Click Connect. A list containing the title and name of all feature layers available in OS Feature API will display in the large box.

QGIS Data Source Manager | WFS dialog showing Server Connections options
6

Select the feature layers you want to add to the map

As a best practice, only load feature layers that you need. This depends on what you're attempting to do. For example, to simulate the OS MasterMap Topography Layer you may need to load all layers, but when using backdrop mapping for visualisation, interrogation and analytical purposes you may only need to load an interest-specific layer.

  • Click the layers you want to apply. You can select multiple layers using your Ctrl/Command key.

  • Check the Only request features overlapping the view extent box (if not already selected). This option engages the bounding box and ensures that only features within the viewing window load (not everything). Your viewing window in your GIS application sets your bounding box.

  • Click Add.

QGIS Data Source Manager | WFS dialog showing OS Features API layers in Server Connections

Depending on the features you selected, adding the layers could take several minutes. The more types of features you call, the longer it will take to load into the GIS. Please be aware that each feature, regardless of its layer, counts towards the request restriction.

7

This limits the amount of feature transactions used. However, because the Render option is unchecked (see instruction in_ step 1 above), the layer selection will not cause data to be loaded immediately.

QGIS UI highlighting Layers checkbox
8

Zoom to your desired scale

We recommend a scale of 1:1,500 or below for WFS requests to multiple layers.

9

Configure a suitable scale range

  1. In the Layers panel right click on a layer and click Properties in the context menu. You can also double-click the layer name.

  2. In the Layer Properties dialog Click Rendering in the left navigation to open the Rendering tab.

  3. Select the Scale Dependent Visibility option (first field). This activates the manual options.

  4. Enter your scale options in the Minimum (exclusive) and Maximum (inclusive) boxes. Rather counter-intuitively, you want the higher value in Minimum (exclusive) and the lower value in Maximum (inclusive). 'exclusive' and 'inclusive' means that in order to obtain your entire range, you need to input your minimum value +1 and your maximum value -1. This allows the layer to display up to and including the selected values. The example below shows how this is taken into account for a scale ranging from 1:1,500 (1,501) to 1:50 (49).

  5. Click _Apply.

QGIS Layer Properties dialog highlighting Minimum and Maximum scaler options

You can now optionally click OK to close the Layer Properties dialog. The Style dropdown (bottom left) allows you to load a predefined stylesheet or customise your own.

10

QGIS will automatically stop calling features should you need to zoom out and reposition your bounding box area of interest.

QGIS UI showing OS Features API data in the map and highlighting Layer and Render checkbox options

Last updated

Was this helpful?