Functions to read tabular or spatial data for management units (GMU) and data analysis units (DAU). Spatial data is returned as sf object.
Usage
lkup_read_gmu(
id = NULL,
species_id = NULL,
name = NULL,
includes = NULL,
pages = list(omit = 1),
...
)
lkup_read_gmu_sf(
id = NULL,
species_id = NULL,
name = NULL,
geometry = c("polygon", "point"),
includes = NULL,
pages = list(omit = 1),
...
)
lkup_read_dau(
id = NULL,
species_id = NULL,
name = NULL,
version_id = NULL,
includes = NULL,
pages = list(omit = 1),
...
)
lkup_read_dau_sf(
id = NULL,
species_id = NULL,
name = NULL,
version_id = NULL,
geometry = c("polygon", "point"),
includes = NULL,
pages = list(omit = 1),
...
)
lkup_share_gmu(
format = c("csv", "json", "parquet"),
id = NULL,
species_id = NULL,
dau_id = NULL,
name = NULL,
geometry = c("none", "polygon", "point"),
includes = NULL,
...
)
lkup_share_dau(
format = c("csv", "json", "parquet"),
id = NULL,
species_id = NULL,
name = NULL,
version_id = NULL,
includes = NULL,
...
)Arguments
- id
integer, id of the record to retrieve
- species_id
integer, filter to a particular species by id
- name
character, name of the unit to filter by
- 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 for spatial data ("polygon" or "point")
- version_id
integer, DAU version to retrieve (latest if NULL)
- format
character, format for sharing ("csv", "json", "parquet")
- dau_id
integer, filter to a particular analysis unit (DAU)
Value
lkup_read_gmu() returns a tibble with columns: id,
analysis_unit_id, region_id, project_id, species_id, name,
abbreviation, number, sort_order. Additional columns may appear
when includes is specified.
lkup_read_dau() returns a tibble with columns: id, version_id,
number, name, abbreviation, sort_order. Additional columns may
appear when includes is specified.
lkup_read_gmu_sf() returns an sf object with the same columns as
read_gmu() plus a geometry column (WGS84, EPSG:4326). Geometry
type is POLYGON or MULTIPOLYGON when geometry = "polygon",
POINT when geometry = "point".
lkup_read_dau_sf() returns an sf object produced by dissolving GMU
boundaries by analysis unit. Columns: analysis_unit_id, project_id,
species_id, version_id, number, name, abbreviation,
sort_order, geometry. Note that the DAU id is renamed to
analysis_unit_id. Geometry type is POLYGON or MULTIPOLYGON when
geometry = "polygon", POINT when geometry = "point" (centroids
of the dissolved polygons).
lkup_share_gmu() returns a single character string: a temporary
authenticated URL for downloading the data. share_gmu() supports
spatial exports via the geometry parameter.
lkup_share_dau() returns a single character string: a temporary
authenticated URL for downloading tabular data. Spatial exports are
not supported because DAU geometry is derived client-side by dissolving
GMU boundaries; use lkup_read_dau_sf() for spatial DAU data.
Details
Management units (GMU) and analysis units (DAU) are species-specific. DAUs are also versioned, with the most recent version returned by default.
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. A helper function exists in
this package to help users read shared data directly into R. See
?read_shared for more information.
Valid includes:
For GMU: species
For DAU: version
Examples
if (FALSE) { # \dontrun{
# Basic reads
lkup_read_gmu()
lkup_read_dau()
# Spatial reads
lkup_read_gmu_sf(geometry = "polygon") # default
lkup_read_gmu_sf(geometry = "point")
lkup_read_dau_sf(geometry = "polygon")
# Filtered reads
lkup_read_gmu(species_id = 1, name = "North Area")
lkup_read_dau(species_id = 1, version_id = 5)
# Share data
lkup_share_gmu(format = "csv")
lkup_share_dau(format = "csv")
} # }