- Account registration process
- Contractor data orders: why was my download request rejected?
- Download Data by Area of Interest
- Downloading Data as a Contractor
- Downloading data in the Data Services Platform (DSP)
- Downloading Large Datasets
- Downloading Risk of Flooding from Surface Water (RoFSW) data
- Downloading Survey Data
- How do I use Web Feature Service (WFS) layers?
- How to create an account on Defra Data Services Platform (DSP)
- I am using a BBOX request when adding my Web Feature Service (WFS) to a map and it is still drawing all the features - what is happening?
- I have confirmed I am using the correct typeName, but I’m still not seeing any features in my map?
- Managing, tracking and cancelling Contractor data orders
- Open Geospatial Consortium (OGC) standards
- Searching for Data on the Defra Data Services Platform (DSP)
- Understanding information (metadata) provided with each Defra Data Services Platform (DSP) dataset
- Understanding the metadata dates displayed for datasets on the Defra Data Services Platform (DSP) and Data.Gov.Uk
- What browsers are supported?
- What is the Defra Data Services Platform (DSP)
- Who can register on the Defra Data Services Platform (DSP)
- Why can't I always download an entire dataset?
- Why can’t I see any layers listed underneath the WMS I have added in QGIS?
- Why clearing cache in a browser is important and how to do it
- Why do I get an error message when loading Web Map Services (WMS) or Web Feature Services (WFS) data?
- Why is my existing Web Feature Service (WFS) request no longer returning any features?
How do I use Web Feature Service (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:
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):
And then the query results are displayed on the map:
Compared to the unfiltered dataset without the last_inspection_date query:
Another example, filtering on the ‘primary_purpose':