| get_ons_geom {osdatahub} | R Documentation |
Retrieve ONS geographies
Description
Query the Office for National Statistics online geography resources.
Usage
get_ons_geom(ons_code, returnType = c("wkt", "geojson", "geos", "sf"))
Arguments
ons_code |
(character) A single ONS code representing a statistical area. |
returnType |
(character) Representation for the returned geometry.
Choose |
Details
The Office for National Statistics (ONS) maintains a source of official geographies for the UK, such as county boundaries, electoral wards, parishes, and census output areas. These boundaries are commonly used for data analysis, particularly of socio-economic factors. A full list of available ONS geographies can be found here: https://statistics.data.gov.uk:443/atlas/resource?uri=http://statistics.data.gov.uk/id/statistical-geography/K02000001.
When returning a geos object, the coordinate reference system
attribute will be set to CRS code 84 by default and not to a full CRS
definition. The sf package must be installed in order to return an
object of class sf.
Data from the ONS are provided under the terms of the Open Government Licence https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/. For more information, please see: https://www.ons.gov.uk/methodology/geography/licences.
Value
The coordinates of the polygon boundary in either Well-Known Text
(WKT) format, GeoJSON format, an object of class geos or as a Simple
Features object of class sf.
Examples
# Retrieve geography.
geog <- get_ons_geom("E05002470")