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.

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

# 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
#> Getting data from https://planit.org.uk/api/applics/geojson?limit=6&bbox=-1.5%2C53.7%2C-1.3%2C53.8&end_date=2021-01-27&start_date=2000-02-01&pg_sz=6
class(res)
#> [1] "sf" "tbl_df" "tbl" "data.frame"
names(res)
#> [1] "address" "altid" "app_size" "app_state" #> [5] "app_type" "associated_id" "authority_id" "authority_name" #> [9] "consulted_date" "decided_date" "description" "distance" #> [13] "docs" "lat" "link" "lng" #> [17] "n_statutory_days" "name" "other_fields" "postcode" #> [21] "rec_type" "reference" "source_url" "start_date" #> [25] "uid" "url" "when_updated" "geometry"
plot(sf::st_geometry(res))
get_planit_data(fmt = "json", limit = 2, bbox = bbox) # return data frame with limit
#> Getting data from https://planit.org.uk/api/applics/json?limit=2&bbox=-1.5%2C53.7%2C-1.3%2C53.8&end_date=2021-01-27&start_date=2000-02-01&pg_sz=2
#> address altid app_size app_state app_type #> 1 10 Aspen Avenue Normanton WF6 2FG NA Small Undecided Full #> 2 19 Westfield Avenue Castleford WF10 5JH NA Small Undecided Full #> associated_id authority_id authority_name consulted_date decided_date #> 1 NA 293 Wakefield NA NA #> 2 NA 293 Wakefield NA NA #> description distance lat #> 1 Attached Garage to side NA 53.70829 #> 2 Single storey extension to side and disabled ramped access NA 53.71197 #> link lng #> 1 https://planit.org.uk/planapplic/Wakefield/21/00166/FUL/ -1.406040 #> 2 https://planit.org.uk/planapplic/Wakefield/21/00149/FUL/ -1.363186 #> n_statutory_days name postcode rec_type reference #> 1 NA Wakefield/21/00166/FUL WF6 2FG PlanApplic NA #> 2 NA Wakefield/21/00149/FUL WF10 5JH PlanApplic NA #> source_url #> 1 https://planning.wakefield.gov.uk/online-applications/search.do?action=advanced #> 2 https://planning.wakefield.gov.uk/online-applications/search.do?action=advanced #> start_date uid #> 1 2021-01-25 21/00166/FUL #> 2 2021-01-22 21/00149/FUL #> url #> 1 https://planning.wakefield.gov.uk/online-applications/applicationDetails.do?activeTab=summary&keyVal=QNHLA8QQLDO00 #> 2 https://planning.wakefield.gov.uk/online-applications/applicationDetails.do?activeTab=summary&keyVal=QNC192QQLAV00 #> when_updated #> 1 2021-01-27T03:34:28.619000+00:00 #> 2 2021-01-27T03:34:28.619000+00:00
get_planit_data(fmt = "json", limit = 2, auth = "leeds")$description
#> Getting data from https://planit.org.uk/api/applics/json?limit=2&bbox=&end_date=2021-01-27&start_date=2000-02-01&pg_sz=2&auth=leeds
#> [1] "Construction of single storey rear extension. - NON MATERIAL AMENDMENT to 19/06703/FU - To allow for extension in depth of single storey extension and reduction in depth of canopy, alterations to approved fenestration and removal of side window." #> [2] "Extension of existing warehouse facility and alterations and reduction of existing car parking - NON MATERIAL AMENDMENT to 18/04001/FU - Inclusion of a sectional door within the elevation facing the car park"
get_planit_data(end_date = "2008-01-01", limit = 2, bbox = bbox)$description # historic data
#> Getting data from https://planit.org.uk/api/applics/geojson?limit=2&bbox=-1.5%2C53.7%2C-1.3%2C53.8&end_date=2008-01-01&start_date=2000-02-01&pg_sz=2
#> [1] "Conversion of garage to habitable room" #> [2] "Change of use of first floor toning bed salon to holistic fitness studio"
get_planit_data(pcode = "LS2 9JT", limit = 2, bbox = bbox)$description # data from specific postcode
#> Getting data from https://planit.org.uk/api/applics/geojson?limit=2&bbox=-1.5%2C53.7%2C-1.3%2C53.8&end_date=2021-01-27&start_date=2000-02-01&pg_sz=2&pcode=LS2%209JT
#> [1] "External alterations including replacement doors and windows and formation of new entrance - NON MATERIAL AMENDMENT to 16/06765/FU - entrance canopy to new north entrance" #> [2] "Consent, agreement or approval required by condition 3 of Planning Application 13/01025/FU"
get_planit_data(query_type = "planapplic", query_value = "13/05235/FU@Leeds")$description
#> Getting data from https://planit.org.uk/planapplic/13/05235/FU@Leeds/geojson?limit=6&bbox=&end_date=2021-01-27&start_date=2000-02-01&pg_sz=6
#> [1] "Full application for 189 new homes including affordable houses and elderly persons apartments, commercial facilities including retail and industrial/employment units and outline application for additional commercial uses"
get_planit_data(query_type = "planarea", query_value = "leeds")$description
#> Getting data from https://planit.org.uk/planarea/leeds/geojson?limit=6&bbox=&end_date=2021-01-27&start_date=2000-02-01&pg_sz=6
#> Warning: Unknown or uninitialised column: `description`.
#> NULL
leeds_area = get_planit_data(query_type = "areas", limit = 2, auth = "Leeds")
#> Getting data from https://planit.org.uk/api/areas/geojson?auth=Leeds&pg_sz=2
plot(leeds_area) # geographic outline of the area
#> Warning: plotting the first 9 out of 25 attributes; use max.plot = 25 to plot all
planitareas = get_planit_data(query_type = "areas", limit = 2)
#> Getting data from https://planit.org.uk/api/areas/geojson?pg_sz=2
nrow(planitareas)
#> [1] 2
planitareas$name
#> [1] "Aberdeen" "Aberdeenshire"
planitareas
#> Simple feature collection with 2 features and 25 fields #> geometry type: MULTIPOLYGON #> dimension: XY #> bbox: xmin: -14.01552 ymin: 54.43398 xmax: -0.32118 ymax: 61.06 #> geographic CRS: WGS 84 #> # A tibble: 2 x 26 #> area_id area_type branch gss_code iso31662_code link long_name mapit_code #> <int> <chr> <dbl> <chr> <chr> <chr> <chr> <int> #> 1 384 Scottish… 2 S120000… GB-ABE http… Aberdeen… 2650 #> 2 385 Scottish… 2 S120000… GB-ABD http… Aberdeen… 2648 #> # … with 18 more variables: n_applications <int>, n_children <int>, #> # n_siblings <int>, name <chr>, openlylocal_code <chr>, osm_rel_code <chr>, #> # own_applications <int>, parent_id <int>, parent_name <chr>, #> # planning_url <chr>, rec_type <chr>, snac_code <chr>, source <chr>, #> # source_url <chr>, url <chr>, when_updated <dttm>, linked_regions <list>, #> # geometry <MULTIPOLYGON [°]>