get_planit_data: Get data from Planit API

Description Usage Arguments Value Examples

View source: R/planit.R

Description

This function requests data from [planit.org.uk](https://www.planit.org.uk). See their [API spec](https://www.planit.org.uk/api/) and their [data dictionary](https://www.planit.org.uk/dictionary/) for further information.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
get_planit_data(
  query_type = "applics",
  query_value = NULL,
  fmt = "geojson",
  base_url = "https://planit.org.uk",
  limit = 6,
  end_date = as.character(Sys.Date()),
  start_date = "2000-02-01",
  auth = NULL,
  pcode = NULL,
  krad = NULL,
  bbox = NULL,
  app_size = NULL,
  app_state = NULL,
  app_type = NULL,
  silent = FALSE
)

Arguments

query_type

The type of query ('"applics"' by default)

query_value

Text string associated with the 'query_type'. To be used only when 'query_type' is not '"applics"'.

fmt

The format of the output ('"geojson"' returns an 'sf' object, '"json"' returns a data frame)

base_url

The base URL of the service

limit

How many items to return (e.g. 6, default)

end_date

E.g. '"2009-02-01"'. Default is 'as.character(Sys.Date())'.

start_date

The earliest application (date of application) to be filtered '"2000-02-01"'

auth

Authority name

pcode

Postcode = UK postcode to use for the centre of a location search

krad

Radius (km) = only planning applications within the circle perimeter are returned (default 2)

bbox

Bounding box in the form of xmin, ymin, xmax, ymax, e.g.: 'c(-1.3, 53.7, -1.2, 53.9)'

app_size

PlanIt classification for the size of planning applications. Values are '"large"' '"medium"' and '"small"'

app_state

Current decision status of the planning application (Undecided, Permitted, Conditions, Rejected, Withdrawn, Referred, Unresolved, Other)

app_type

Type of the application (Full, Outline, Amendment, Heritage, Trees, Advertising, Telecoms, Other)

silent

Do you want a message? Default is 'FALSE'

Value

A (geographic) data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# tmaptools::bb("university leeds") # find a bounding box
bbox = c(-1.5, 53.7, -1.3, 53.8)
res = get_planit_data(bbox = bbox, silent = FALSE) # return geographic (`sf`) object
class(res)
names(res)
plot(sf::st_geometry(res))
get_planit_data(fmt = "json", limit = 2, bbox = bbox) # return data frame with limit
get_planit_data(fmt = "json", limit = 2, auth = "leeds")$description
get_planit_data(end_date = "2008-01-01", limit = 2, bbox = bbox)$description # historic data
get_planit_data(pcode = "LS2 9JT", limit = 2, bbox = bbox)$description # data from specific postcode
get_planit_data(query_type = "planapplic", query_value = "13/05235/FU@Leeds")$description
get_planit_data(query_type = "planarea", query_value = "leeds")$description
leeds_area = get_planit_data(query_type = "areas", limit = 2, auth = "Leeds")
plot(leeds_area) # geographic outline of the area
planitareas = get_planit_data(query_type = "areas", limit = 2)
nrow(planitareas)
planitareas$name
planitareas

cyipt/acton documentation built on Jan. 29, 2021, 7:30 a.m.