Skip to main content

Change your cookie settings

We cannot change your cookie settings at the moment because JavaScript is not running in your browser. To fix this, try:

  1. turning on JavaScript in your browser settings
  2. reloading this page
View cookies

Change your cookie settings

We cannot change your cookie settings at the moment because JavaScript is not running in your browser. To fix this, try:

  1. turning on JavaScript in your browser settings
  2. reloading this page
View cookies
  1. Home
  2. Support
  3. FAQs
  4. How Do I Use WFS Layers?

How Do I Use WFS Layers?

Created: 03 April 2019 Updated: 23 May 2024

A Web Feature Service (WFS) is a way of accessing spatial vector data via a streaming feed, without the user having to download all of the data.  Your GIS software will be able to connect to the service (refer to your software user guide for details) and then you can use the data like a normal spatial layer.

There are some known issues with connecting to Defra DSP WFS services. In some cases, the X and Y co-ordinates are translated differently by different software.  If the data does not display as expected, you may need to reconnect to the WFS, choosing the “Invert axis orientation” option (or equivalent).
If you cannot connect at all, you may need to add some additional parameters to the WFS URL.

Client programs like ArcGIS and QGIS can be provided with service parameters that enable them to use the WFS more fully. The service capabilities provide information on what parameters the service can use.

To obtain the service capabilities, add parameters to the WFS link like in the following example: 

https://environment.data.gov.uk/spatialdata/chalk-rivers/wfs?REQUEST=GetCapabilities&SERVICE=WFS

These are examples of WFS links with additional parameters:

https://environment.data.gov.uk/spatialdata/flood-map-for-planning-rivers-and-sea-flood-zone-3/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=Flood_Map_for_Planning_Rivers_and_Sea_Flood_Zone_3&BBOX=450660,332709,461502,347119,EPSG:27700&srsName=EPSG:27700   

https://environment.data.gov.uk/spatialdata/historic-flood-map/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAME=Historic_Flood_Map&BBOX=444018,321614,489124,401169,EPSG:27700&srsName=EPSG:27700

Coordinate Axis management:

WFS services can honour several OGC WFS versions. WFS version 1.0.0 transmits coordinates as XY (Long/Lat), whereas versions 1.1.0 and 2.0.0 transmit them as YX (Lat/Long), therefore affecting how XY coordinates are translated by clients like ArcMap, ArcGIS Pro, QGIS etc. They all have certain rules of setting these parameters once they have read the capabilities. 

Many queries from WFS users have been resolved this by setting the axis orientation setting on their client software.

The default OGC settings are:
Default axis for WFS version 1.0.0.            X Y (long/lat)
Default axis for WFS version 1.1.0             Y X (lat/long)
Default axis for WFS version 2.0.0             Y X (lat/long)

OGC Filter Encoding Specification

WFS published on the DSP support the OGC Filter Encoding specification which lets users query on properties of the data. Using this functionality allows users to only return data that is needed. For example, data can be queried by attribute. Using Asset (AIMS) data as an example:

The following request finds all AIMS points that have a ‘last_inspection_date' in the year 2023.

(Since the year in this data is stored as a string rather than a datetime we need to do a ‘like' query): ,

<https://environment.data.gov.uk/geoservices/datasets/019a8eaa-b27f-4ae6-a9fd-e8e27cdd101a/wfs?SERVICE=WFS&REQUEST=GetFeature&VERSION=2.0.0&TYPENAMES=dataset-019a8eaa-b27f-4ae6-a9fd-e8e27cdd101a:AIMS_Structure_Point&STARTINDEX=0&COUNT=300000&SRSNAME=urn:ogc:def:crs:EPSG::27700&FILTER=fes:Filter xmlns:fes="http://www.opengis.net/fes/2.0">

<fes:PropertyIsLike singleChar="_" wildCard="%" escapeChar="\">

fes:ValueReferencelast_inspection_date</fes:ValueReference>

fes:Literal%2023%</fes:Literal>

</fes:PropertyIsLike>

</fes:Filter>

&outputFormat=application/json&count=100

This URL will return the first 100 features that match this search.

QGIS also has the ability to create these queries (which QGIS then translates into the WFS request above):

image-20240523-152452.png

And then the query results are displayed on the map:

image-20240523-152512.png

Compared to the unfiltered dataset without the last_inspection_date query:

image-20240523-152542.png

Another example, filtering on the ‘primary_purpose':

image-20240523-152557.png