# 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).

The instructions that follow demonstrate how to connect to OS NGD API – Features using QGIS.

## What you need

* QGIS (version 3.12.0 or later).
* A preloaded basemap, for example, [OS Maps API](https://app.gitbook.com/s/oEzqrBzRGoJw7nQyLj1W/accessing-os-apis/os-maps-api "mention") or [OS Vector Tile API](https://app.gitbook.com/s/oEzqrBzRGoJw7nQyLj1W/accessing-os-apis/os-vector-tile-api "mention").
* OS NGD API – Features added to an API project in the OS Data Hub with an API Key. See [Getting started with an API project](https://app.gitbook.com/s/oEzqrBzRGoJw7nQyLj1W/core-concepts/getting-started-with-an-api-project "mention") for more information.&#x20;

## Instructions

{% hint style="info" %}

### Connecting to OS NGD API – Features

If you are connecting to the OS NGD API for the first time then you can follow **either step 2 or step 3** to set up a new connection via QGIS. It is not necessary to follow both steps.
{% endhint %}

{% stepper %}
{% step %}

### Set up a new connection

Once a new project with a base map has been set up, zoom in to a small area to reduce the number of requests that are initially sent to the API. Select Layer > Add Layer > Add WFS / OGC API - Features Layer.

<figure><img src="https://170091638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0pZjHxkAvY7Mn6TqFBMD%2Fuploads%2Fuyr5XMh17XiMKWjwXGSl%2FQGIS%20-%20Add%20WFS_OGC%20API%20-%20Features%20connection.png?alt=media&#x26;token=dfb6d8a3-91b5-4a18-b298-fffe502f51f7" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Create a new connection in the WFS Connection dialog

In the Data Source Manager | WFS / OGC API - Features dialog click New and in the New WFS Connection dialog:

* **Name**: Provide a name for the connection. \
  \&#xNAN;*You can reuse this connection in the future.*
* **URL**: Copy the OS NGD API – Features endpoint address from the OS Data Hub and paste it into this field. \
  \&#xNAN;*Your API Key is automatically appended to this URL in the `key` parameter.*
* **Authentication**: Leave these settings at their defaults. \
  \&#xNAN;*You do not need a username or password as authentication is done through your API Key.*
* **Version**: Click *Detect* to identify the version.
* **Enable feature paging**: Select this option, if necessary.
* **Page size**: Enter a maximum page size. \
  \&#xNAN;*This limits the page size to a maximum number of features. We recommend a setting of about `100` to speed up response times. Larger values may result in a very slow response time.*
* Other: Leave the other settings at their defaults.
* Click *OK*.

<figure><img src="https://170091638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0pZjHxkAvY7Mn6TqFBMD%2Fuploads%2FAamIqMv3mICWOyyJgcZZ%2Fos-ngd-api-features-qgis-create-new-wfs-connection.png?alt=media&#x26;token=56c4695f-e5d0-4b4c-9f10-2d56650c0a45" alt="" width="452"><figcaption><p>QGIS Create a New WFS Connection dialog.</p></figcaption></figure>
{% endstep %}

{% step %}

### Create a new connection using a saved server configuration

The Ordnance Survey GitHub repository contains API resources contains configuration files that can be loaded directly into the QGIS Data Source Manager following the [Connecting to web services guide in the QGIS documentation](https://docs.qgis.org/3.40/en/docs/user_manual/managing_data_source/opening_data.html#connecting-to-web-services).&#x20;

{% embed url="<https://github.com/OrdnanceSurvey/osngd-resources/tree/main/api-resources>" %}
Access the OS NGD API resources here
{% endembed %}
{% endstep %}

{% step %}

### Adding layers to the map

Data Source Manager | WFS / OGC API - Features dialog:

* Select your new connection in the dropdown, if necessary.
* Click *Connect*.

<figure><img src="https://170091638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0pZjHxkAvY7Mn6TqFBMD%2Fuploads%2FxBvvUdIamjcynuaPSGMd%2Fqgis-connect.PNG?alt=media&#x26;token=a88c00ad-8592-4dfb-96ad-9683b53da264" alt="QGIS Data Source Manager | WFS > Server Connections."><figcaption><p>QGIS Data Source Manager | WFS > Server Connections.</p></figcaption></figure>

When you click Connect, a list of layers available in OS NGD API – Features populates in the main box:&#x20;

* **To add a layer to the map**: Select the layer to highlight it. You can select multiple layers by using the Ctrl key.

{% hint style="info" %}
As best practice, only load layers that relate to your current task  – not all layers. The more features you call, the longer it takes to load them into QGIS. In addition, each feature, regardless of its layer, counts towards your [rate limits](https://docs.os.uk/os-apis/core-concepts/rate-limiting-policy).&#x20;
{% endhint %}

* **Only request features overlapping the view extent**: Select this option.
* Click  *Add.*

<figure><img src="https://170091638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0pZjHxkAvY7Mn6TqFBMD%2Fuploads%2FHvmkRAIAdWdgMIVwaid7%2FQGIS%20Add%20Layer.png?alt=media&#x26;token=707e381d-a860-4088-97a7-8f81636676ca" alt="QGIS Data Source Manager | WFS / OGC API - Features."><figcaption><p>QGIS Data Source Manager | WFS / OGC API - Features.</p></figcaption></figure>

*The layer will then display in the Layers panel and the data will display on the map:*

<figure><img src="https://170091638-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0pZjHxkAvY7Mn6TqFBMD%2Fuploads%2FKxyH1FWGWntcHtj7fYPs%2FQGIS%20Map%20Rendered.png?alt=media&#x26;token=b9c27f86-337d-4729-9e31-59dcf1fb1259" alt="QGIS UI showing OS NGD API - Features data in the Layers panel and map area."><figcaption><p>QGIS UI showing OS NGD API – Features data in the Layers panel and map area.</p></figcaption></figure>
{% endstep %}
{% endstepper %}
