Skip to contents

Queries ONS' Geoportal endpoints and retrieves the requested geographical boundaries in the form of a sf object.

Usage

boundaries_get(boundary, year = NULL, detail_level = "BUC")

Arguments

boundary

a string containing the acronym of name of the boundary to be downloaded. Accepted values are: CAUTH, CED, CTRY, CTY, CTYUA, LAD, LPA, LSOA, MCTY, MSOA, OA, PAR, PARNCP, RGN, UTLA, WD

year

a number containing the year when the boundary was created.

detail_level

a string defining the level of detail in the geometry. (this affects the download size). Accepted values are: BFC, BFE, BGC, BUC. Each value corresponds to:

  • Full Extent (BFE) – Full resolution boundaries go to the Extent of the Realm (Low Water Mark) and are the most detailed of the boundaries.

  • Full Clipped (BFC) – Full resolution boundaries that are clipped to the coastline (Mean High Water mark).

  • Generalised Clipped (BGC) - Generalised to 20m and clipped to the coastline (Mean High Water mark) and more generalised than the BFE boundaries.

  • Super Generalised Clipped (BSC) (200m) – Generalised to 200m and clipped to the coastline (Mean High Water mark).

  • Ultra Generalised Clipped (BUC) (500m) – Generalised to 500m and clipped to the coastline (Mean High Water mark).

  • Grid, Extent (BGE) - Grid formed of equally sized cells which extend beyond the coastline.

  • Generalised, Grid (BGG) - Generalised 50m grid squares.

For a detailed description of how these boundaries were created refer to Digital boundaries

Value

a sf object with the selected boundaries.

Examples

countries_2023 <- boundaries_get("CTRY", 2023, "BUC")
#>  Querying ONS API
#>  Querying ONS API [8ms]
#> 
#> ⠙ Downloading the selected dataset from ONS services
#> Warning: GDAL Message 1: organizePolygons() received a polygon with more than 100 parts. The processing may be really slow.  You can skip the processing by setting METHOD=SKIP, or only make it analyze counter-clock wise parts by setting METHOD=ONLY_CCW if you can assume that the outline of holes is counter-clock wise defined
#>  Downloading the selected dataset from ONS services [1.2s]
#> 

class(countries_2023)
#> [1] "sf"         "tbl_df"     "tbl"        "data.frame"