UK-SCAPE hydrology API | Access to live data
This application programming interface (API) is acting as a middleware to various APIs related to water. It is designed to output data from various sources in a common format for ease of use.
The organisations that have data available in this API are:
- National river flow archive (
NRFA
); various data-types available. - Met Office (
MO
); recently observed and forecast weather data. - Environment Agency (
EA
); near realtime river flow and water quality data.EA-local
is a copy of the EA dataset downloaded into the NRFA database. - Natural Resources Wales (
NRW
); water quality data. - Scottish Environment Protection Agency (
SEPA
); rainfall data available from approx October 2017. - Environment Agency (
EA
); water quality data.
Organisation codes mentioned below are the acronyms
in the above list.
Water quality (WQ) data
Since the EA's API for the water quality data has extra complexity and there are many thousands of sampling points, the calls are slightly different to the above.
Please note that some of these calls will time out as there is simply too much data to return.
View an example deployment where all the EA subareas are listed within their parent. You can click on a subarea to see its sampling points on the map and then click on a sampling point to see all the determinands measured there. Then click on a determinand to see a graph of the available data.
These calls will also work for the NRW water quality data except for those that reference the WFD catchments in Wales.
To get a list of all sites for an area
You can either retrieve sites within an EA subarea or for a distance around a point.
The EA subareas are taken from https://environment.data.gov.uk/water-quality/id/ea-area.html. You can see a list of them within their parent area on the example. The IDs are the small text next to the subarea name.
To get a list of sampling points for a subarea use http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ?subArea=[subareaID] like http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ?subArea=4-12-L
To get a list of sampling points for a radius around a point use http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ?dist=[radius]&latitude=[latitude]&longitude=[longitude] like http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ?dist=20&latitude=52.190772371135374&longitude=-1.5692502718212744.
To retrieve timeseries data for a particular determinand at a sampling point
Use http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ/[samplingPointID]?determinand=[determinandID] like http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ/AN-01M02?determinand=9901.
You can filter the data by date range: http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/WQ/AN-01M02/2018-01-01/2021-01-01?determinand=9901
Find out about the availability of the WQ data
You can search for WQ sites to see the available data using http://eip.ceh.ac.uk/hydrology-ukscape/WQdataAvailability and a combination of the options like the below.
Options: {
startYear: 2000,
endYear: 2019,
siteIDs: 'SO-Y0004402,NW-88021734',
determinands: 0061,0192,
latitude: 55.435895119108686,
longitude: -1.7834570761075501,
easting:413800,
northing:615800,
distMetres: 10000,
minNumMeasurements: 300,
HAs:21,22,
siteType: 'rivers' or 'lakes'
}
Examples
To get all sites within 5km of 413800, 615800, use http://eip.ceh.ac.uk/hydrology-ukscape/WQdataAvailability?easting=413800&northing=615800&distMetres=5000.
To get all sites within 5km of 55.435895119108686, -1.7834570761075501, use http://eip.ceh.ac.uk/hydrology-ukscape/WQdataAvailability?latitude=55.435895119108686&longitude=-1.7834570761075501&distMetres=5000.
To get sites that measured phosphorus (0348) or carbon (0099) between 2002 and 2006, use http://eip.ceh.ac.uk/hydrology-ukscape/WQdataAvailability?determinands=0348,0099&startYear=2002&endYear=2006.
To get sites that have measured Ammonia (0111) at least 2000 times, use http://eip.ceh.ac.uk/hydrology-ukscape/WQdataAvailability?determinands=0111&minNumMeasurements=2000
List stations for an organisation
To get a list of all the data-types and stations for a particular organisation, use http://eip.ceh.ac.uk/hydrology-ukscape/stations/[organisation code]/.
Example: http://eip.ceh.ac.uk/hydrology-ukscape/stations/NRFA
EA station lists for rainfall and flow are different, so you need to add flow
or rainfall
after the organisation code to get the correct list, like http://eip.ceh.ac.uk/hydrology-ukscape/stations/EA/rainfall, although flow
is the default.
Get a single station's details and data
Use the ref or ID for the station ID as advised in the notes of the stations list. You must pass in a data-type before the station ID. You can pass in the organisation's data-type or if there is an equivalent NRFA version, you can add that, such as gdf
. The default is the first type in the array:
Example: http://eip.ceh.ac.uk/hydrology-ukscape/stations/NRFA/gdf/46008.
You can pass in optional start and end date:
Example: http://eip.ceh.ac.uk/hydrology-ukscape/stations/NRFA/gdf/46008/2017-01-01/2018-09-01.
You can also download the data as csv by adding ?fileType=csv
to the URL like http://eip.ceh.ac.uk/hydrology-ukscape/stations/NRFA/gdf/46008/2017-01-01/2018-09-01?fileType=csv.
Lookup EA wiskiIDs
You can use http://eip.ceh.ac.uk/hydrology-ukscape/lookup to get a list of the equivalent IDs of an NRFA station or viceversa to add to query strings.
If you add the organisation code and stationID to the URL, you can get the details for a particular station. Like http://eip.ceh.ac.uk/hydrology-ukscape/lookup/NRFA/45001 and if you add true after the end, you can also get the EA notation, like http://eip.ceh.ac.uk/hydrology-ukscape/lookup/NRFA/45001/true.