Functions to read and share region data. Regions are the highest level in the spatial hierarchy: regions -> DAU -> GMU -> subunits.
Usage
lkup_read_region(
id = NULL,
project_id = NULL,
name = NULL,
abbreviation = NULL,
includes = NULL,
pages = list(omit = 1),
...
)
lkup_read_region_sf(
id = NULL,
project_id = NULL,
name = NULL,
abbreviation = NULL,
geometry = c("polygon", "point"),
includes = NULL,
pages = list(omit = 1),
...
)
lkup_share_region(
format = c("csv", "json", "parquet"),
id = NULL,
project_id = NULL,
name = NULL,
abbreviation = NULL,
geometry = c("none", "polygon", "point"),
includes = NULL,
...
)Arguments
- id
integer, id of the record to retrieve
- project_id
integer, filter to a particular project
- name
character, filter by region name
- abbreviation
character, filter by region abbreviation
- includes
character vector of related resources to include
- pages
list of pagination arguments (size, number, omit)
- ...
additional filters to include in the query
- geometry
character, type of geometry ("polygon" or "point") for spatial data
- format
character, format for sharing ("csv", "json", "parquet")
Value
lkup_read_region() returns a tibble with columns: id, project_id,
name, abbreviation, number, sort_order. Additional columns may
appear when includes is specified.
lkup_read_region_sf() returns an sf object with the same columns plus a
geometry column (WGS84, EPSG:4326). Geometry type is POLYGON or
MULTIPOLYGON when geometry = "polygon", POINT when
geometry = "point".
lkup_share_region() returns a single character string: a temporary
authenticated URL for downloading the data.
Details
Regions represent the largest spatial aggregation in the hierarchy. While they provide important context, they are less commonly used in analyses compared to GMUs and DAUs.
Spatial data is returned in WGS84 (EPSG:4326) projection.
When sharing spatial data, the format must be "json". This ensures valid GeoJSON output that can be read by GIS software.
Valid includes:
project
Examples
if (FALSE) { # \dontrun{
# Basic read
lkup_read_region()
lkup_read_region(name = "North")
# Spatial reads
lkup_read_region_sf() # defaults to polygons
lkup_read_region_sf(geometry = "point")
# Share data
lkup_share_region(format = "csv")
# For spatial data
lkup_share_region(format = "json", geometry = "polygon")
} # }