Convenience wrapper on bcdata::bcdc_query_geodata() and bcdata::collect() to retrieve Web Feature Service data from the BC Data Catalogue.
rfp_bcd_get_data.Rd
This function queries geospatial data from the BC Data Catalogue using a specified record ID. It conditionally filters the data based on a provided column identifier and value(s), selects specific columns, cleans the column names. Geometry of object returned can be dropped if desired
Usage
rfp_bcd_get_data(
bcdata_record_id,
col_extract = NULL,
drop_geom = FALSE,
col_filter = NULL,
col_filter_value = NULL
)
Arguments
- bcdata_record_id
A character string specifying the BC Data Catalogue record ID permanent id (7ecfafa6-5e18-48cd-8d9b-eae5b5ea2881), name of the record (pscis-assessments) or
object name
(ex. WHSE_FISH.PSCIS_ASSESSMENT_SVW). The name of the record can be found at https://catalogue.data.gov.bc.ca/. This does not need to be in capitals as we will convert to capitals within the function.- col_extract
A character vector specifying which columns to select from the data. Cannot be NULL.
- drop_geom
A logical value indicating whether to drop the geometry column from the
sf
object. Default is FALSE- col_filter
A character string specifying the column identifier to filter data on. If NULL (default), no filtering is applied. Colunn name will be converted to upper case if supplied in other format.
- col_filter_value
A character or character vector specifying the values to filter
col_filter
by. If NULL (default), no filtering oncol_filter
is applied.olunn name will be converted to upper case if supplied in other format.
See also
rfp_meta_bcd_xref
for a function that extracts metadata from the BC Data Catalogue.
Examples
if (FALSE) { # \dontrun{
rfp_bcd_get_data(bcdata_record_id = "7ecfafa6-5e18-48cd-8d9b-eae5b5ea2881",
col_filter = 'FUNDING_PROJECT_NUMBER',
col_filter_value = 'skeena_2023_Phase1',
col_extract = c('EXTERNAL_CROSSING_REFERENCE', 'STREAM_CROSSING_ID'),
drop_geom = TRUE)
rfp_bcd_get_data(bcdata_record_id = "bc-airports", col_extract = c('AIRPORT_NAME', 'DESCRIPTION')) # Retrieves all records without filtering on col_filter
} # }