Skip to contents

Return centroid points at a specified level and area from the ONS OG API

Usage

points(
  lookup,
  within = NULL,
  within_names = NULL,
  within_codes = NULL,
  return_width = c("tidy", "full", "minimal"),
  lookup_year = NULL,
  within_year = NULL,
  country_filter = c("UK|GB|EW|EN|SC|WA", "UK", "GB", "EW", "EN", "SC", "WA"),
  resolution = c("BGC", "BSC", "BUC", "BFC", "BFE"),
  option = NULL,
  crs = 4326
)

Arguments

lookup

character. Lower level area code eg "lsoa", "wd", "lad". Equivalent to the lookup parameter in bounds().

within

character. Higher level area code eg "lad", "cty". Equivalent to the within parameter in bounds().

within_names, within_codes

character. In order to restrict data returned to a specific area, either within_names or within_codes must be provided. Otherwise all boundaries within the country at that level will be retrieved. Use place names eg "Essex" to restrict to a certain geographical area. Use ONS area codes eg "W02000103" likewise (this is useful with wards, where there are many that share identical names). A vector of multiple names or codes can be supplied.

return_width

character. How many of the possible columns in the returned table to keep. Options are "tidy", "full" or "minimal".

lookup_year

numeric or character. A specific year for data relating to parameter x, if needed. Defaults to NULL, which will return the most recent data.

within_year

numeric or character. A specific year for data relating to parameter y, if needed. Defaults to NULL, which will return the most recent data.

country_filter

character. Open Geography datasets are sometimes available just within certain countries. Specify a country code if you want your results restricted to a certain country only - eg "WA" for Wales, "EW" for England and Wales. By default returns all options.

resolution

character. See argument options for available options. How generalised should the boundary be, and whether coastal boundaries should adhere to the coastline or to the full territorial extent. BGC by default (G = Generalised (20m), C = limited to the coastline.) F indicates Full resolution; S indicates Super-generalised (200m); U indicates Ultra- generalised (500m) boundary resolution. Use E instead of C for full extent boundaries (e.g. BFE). Not all combinations are available.

option

numeric. Defaults to 1, which means that the URL will just be the first one from the list of possible services resulting from the level and year filters above. If this does not give you what you want, you can run the script again with a different option from the list.

crs

the Coordinate Reference System (CRS) code to use. 4326 by default.

Value

an sfc tibble (data frame with geometry)