Skip to contents

Introduction

The UK CEH Lake Portal is a GIS-based inventory of information about more than 40000 lakes across the UK. The information available for each lake varies, but includes basic physical description, typology and other information.

The uklakes package allows you to retrieve a summary of the lake information for a lake or series of lakes, based on the lake wbid (waterbody id) number. It does this by responsibly webscraping the information polite package) from the webpage of each lake as the website does not provide an API or any easy way to extract the data returned. You can also search for lake wbid values based on strings in the lake name to determine the wbids to search for.

Information on the general physical characteristics, typology, chemistry and connectivity metrics are retrieved. Biology, land cover and water quality information are not. For details of the information available, see the UK Lakes Portal Website, or the output reference list.

Use of the package implies acceptance of the Terms of Use available here.

Functions

Search for wbid numbers

The search_lake function allows you to search a listing of all the lakes within the portal, based on a string provided. It will return a dataframe containing the name and wbid number of all the lakes that contain (full or partial match, case sensitive) the string provided. Note that most of the lakes within the portal (particularly the small ones) do not have a name (76% of total).

library(uklakes)
all_tarns <- search_lake("Tarn")
nrow(all_tarns)
#> [1] 140
# 140 Tarns in the portal database

# first six tarns in the list
head(all_tarns)
#>               Name  wbid  Country Easting Northing
#> 1      Tarnie Loch 23031 Scotland  365150   754370
#> 2      Talkin Tarn 28386  England  354540   558750
#> 3     Tindale Tarn 28395  England  360520   558710
#> 4      Martin Tarn 28561  England  325790   551540
#> 5        Tarns Dub 28651  England  311530   547380
#> 6 Greencastle Tarn 28736  England  369770   539940

search_lake("Leven")
#>                Name  wbid  Country Easting Northing
#> 1 Loch of Levenwick  1567 Scotland  441350  1119860
#> 2        Loch Leven 18194 Scotland  294670   842540
#> 3        Loch Leven 24843 Scotland  314720   701460
# two Loch Levens and one Loch of Levenwick

The wbid column of the dataframe returned can be used as input to the data retrieval function (see below for examples).

Get a summary of information for a lake or lakes

The get_lake_info function retrieves the available information for a lake or lakes, based on the wbid numbers provided.

Wbid numbers can be passed to the function as a single integer, a series of integer values, a sequence of values, a vector of values (either as a specific object or as a column of a dataframe) or a combination of these. See examples below.

# some small lakes in Shetland
get_lake_info(4, 6, 1232:1234)
#> Scraping lake wbid 4
#> Scraping lake wbid 6
#> Scraping lake wbid 1232
#> Scraping lake wbid 1233
#> Scraping lake wbid 1234
#>   wbid           Name Grid_reference Easting Northing Elevation_type  Size_type
#> 1    4 Sothers Brecks     HP60551629  460550  1216290  Low elevation Very small
#> 2    6        unnamed     HP67201542  467200  1215420  Low elevation Very small
#> 3 1232        unnamed     HU26195455  426190  1154550  Low elevation Very small
#> 4 1233        unnamed     HU27475458  427470  1154580  Low elevation Very small
#> 5 1234   Restna Lochs     HU20375453  420370  1154530  Low elevation Very small
#>     Depth_type          Geology_type            Humic_type Surface_area
#> 1 Very shallow Unavailable (no data) Unavailable (no data)            0
#> 2 Very shallow Unavailable (no data) Unavailable (no data)            0
#> 3      Shallow       High alkalinity Unavailable (no data)            4
#> 4 Very shallow Unavailable (no data) Unavailable (no data)            0
#> 5      Shallow       High alkalinity Unavailable (no data)            2
#>   Elevation Perimeter_length Shoreline_development_index Fetch_distance
#> 1       122                0                        1.04           0.05
#> 2        18                0                        1.05           0.04
#> 3        38                1                        1.50           0.38
#> 4        47                0                        1.05           0.09
#> 5       146                1                        1.08           0.23
#>   Distance_to_sea Mean_depth Catchment_area Water_body_volume
#> 1            0.65         NA             NA                NA
#> 2            0.04         NA             NA                NA
#> 3            1.92        3.4             23            123516
#> 4            1.31         NA             NA                NA
#> 5            2.50        3.7             24             90444
#>   Catchment-to-lake_ratio Catchment_mean_elevation Catchment_mean_slope
#> 1                      NA                       NA                   NA
#> 2                      NA                       NA                   NA
#> 3                     6.4                    42.61                 2.47
#> 4                      NA                       NA                   NA
#> 5                     9.9                   153.80                 2.72
#>   Catchment_pond_area Catchment_strahler_1_length Catchment_strahler_2_length
#> 1                  NA                          NA                          NA
#> 2                  NA                          NA                          NA
#> 3                4.08                      519.41                      132.69
#> 4                  NA                          NA                          NA
#> 5                  NA                      590.66                      152.94
#>   2km_buffer_river_length 2km_buffer_lakes_perimeter 2km_buffer_ponds_perimeter
#> 1                      NA                         NA                         NA
#> 2                      NA                         NA                         NA
#> 3                24979.54                  135452.50                   12586.71
#> 4                      NA                         NA                         NA
#> 5                32894.07                   10388.93                     817.48
#>   Catchment_lake_area
#> 1                  NA
#> 2                  NA
#> 3                  NA
#> 4                  NA
#> 5                 8.9

# the first 5 lakes containing 'Tarn' in the database
all_tarns <- search_lake("Tarn")
get_lake_info(all_tarns$wbid[1:5])
#> Scraping lake wbid 23031
#> Scraping lake wbid 28386
#> Scraping lake wbid 28395
#> Scraping lake wbid 28561
#> Scraping lake wbid 28651
#>    wbid         Name Grid_reference Easting Northing Elevation_type  Size_type
#> 1 23031  Tarnie Loch     NO65155437  365150   754370  Low elevation Very small
#> 2 28386  Talkin Tarn     NY54545875  354540   558750  Low elevation      Small
#> 3 28395 Tindale Tarn     NY60525871  360520   558710  Mid elevation      Small
#> 4 28561  Martin Tarn     NY25795154  325790   551540  Low elevation Very small
#> 5 28651    Tarns Dub     NY11534738  311530   547380  Low elevation Very small
#>     Depth_type          Geology_type            Humic_type Marl_water_body
#> 1 Very shallow Unavailable (no data) Unavailable (no data)           FALSE
#> 2      Shallow             Marl lake Unavailable (no data)            TRUE
#> 3 Very shallow   Moderate alkalinity                 Humic           FALSE
#> 4      Shallow       High alkalinity Unavailable (no data)           FALSE
#> 5      Shallow       High alkalinity Unavailable (no data)           FALSE
#>   Surface_area Elevation Perimeter_length Shoreline_development_index
#> 1            0       121                0                        1.29
#> 2           25       128                2                        1.17
#> 3           25       214                2                        1.25
#> 4            5        18                1                        1.06
#> 5            8        18                1                        1.06
#>   Fetch_distance Distance_to_sea Mean_depth Maximum_depth Catchment_area
#> 1           0.11            3.61         NA            NA             NA
#> 2           0.77           18.35        5.0          12.5            106
#> 3           0.87           24.11        1.9           4.2            804
#> 4           0.28            4.41        5.0            NA             32
#> 5           0.36            2.95        5.1            NA             83
#>   Water_body_volume Catchment-to-lake_ratio Catchment_mean_elevation
#> 1                NA                      NA                       NA
#> 2           1274563                     4.1                   141.66
#> 3            474201                    32.4                   376.98
#> 4            243692                     6.5                    22.56
#> 5            436432                     9.7                    31.22
#>   Catchment_mean_slope Catchment_strahler_1_length 2km_buffer_river_length
#> 1                   NA                          NA                      NA
#> 2                 2.80                      166.04                21784.86
#> 3                 9.62                     6750.08                18732.34
#> 4                 1.78                      303.90                22983.18
#> 5                 2.42                          NA                16673.16
#>   Mean_alkalinity Mean_conductivity Catchment_strahler_2_length
#> 1              NA                NA                          NA
#> 2             681               121                          NA
#> 3             892               140                     3472.66
#> 4              NA                NA                      149.75
#> 5              NA                NA                          NA
#>   Catchment_strahler_4_plus_length Catchment_obstacles_count Mean_colour
#> 1                               NA                        NA          NA
#> 2                               NA                        NA          NA
#> 3                            19.84                         4          51
#> 4                               NA                        NA          NA
#> 5                            54.38                        NA          NA
#>   Mean_dissolved_organic_carbon 2km_buffer_canals_length
#> 1                            NA                       NA
#> 2                            NA                       NA
#> 3                          6.37                       NA
#> 4                            NA                       46
#> 5                            NA                       NA

The range of information provided varies widely between lakes. Basic physical description and typology information are always returned. For a full listing of the possible columns see the output reference listing.