get_boundary: Fetch boundary data from the geoportal API

Description Usage Arguments Value Examples

View source: R/get_boundary.R

Description

Gets geoportal boundary data using either:

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
get_boundary(
  boundary_type = c("administrative", "census", "electoral", "eurostat", "health",
    "other", "postcodes"),
  boundary_name = NA,
  bbox = NA,
  radius = NA,
  point = NA,
  names_like = NA,
  names_equal = NA,
  custom_polygon = NA,
  verbose = FALSE
)

Arguments

boundary_type

category of boundary to fetch. Options are: "administrative", "census", "electoral", "eurostat", "health", "other", or "postcodes".

boundary_name

boundary name. If not specified, will return a list of available boundary names for the chosen boundary type.

bbox

if specified will only return results within the specified bounding box. Bounding box should either be in the format 'xmin,ymin,xmax,ymax', or be an object of class 'bbox' as generated by sf::st_bbox().

radius

radius in meters. If specified, will only return results within a given radius of the point. Point must be specified for radius to take effect.

point

a longitude,latitude string in the form 'lng,lat'. Point and radius must be specified together to return boundaries within given radius to the point.

names_like

a vector of names that we want the name column to partially match.

names_equal

a vector of names that we want the name column to exactly match.

custom_polygon

a custom sf polygon. The function will return all boundaries that intersect the custom polygon.

Value

a data.frame of the full player data and history.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# get available boundary names for the type 'census'
census_options <- get_boundary('census')

# get all MSOA boundaries where the msoa name contains 'Dartford' or 'Gravesham':
msoa_boundaries_like <- get_boundary('census','Middle_Super_Output_Areas_December_2011_Boundaries',
 names_like=c('Dartford','Gravesham'))

# get all local authority boundaries where the name is either 'Tower Hamlets' or 'Southwark'
la_boundaries_exact <- get_boundary('admin','Local_Authority_Districts_April_2019_Boundaries_UK_BGC',
 names_equal=c('Tower Hamlets','Southwark'))

# get all wards  within a specified bounding box
la_bbox <- sf::st_bbox(la_boundaries_exact)
ward_boundaries_bbox <- get_boundary('administrative','Wards_May_2019_Boundaries_UK_BGC', bbox=la_bbox)


# get all LSOA boundaries within a 1km radius of a given point
point <- '-0.1577,51.507'
lsoa_boundaries_radius <- get_boundary('census','Lower_Super_Output_Areas_December_2011_Boundaries',
 point=point, radius=1000)

Chrisjb/rgeoportal documentation built on Sept. 29, 2020, 12:46 a.m.