bcdc_query_geodata {bcdata} | R Documentation |
Query data from the B.C. Web Feature Service
Description
Queries features from the B.C. Web Feature Service. See
bcdc_tidy_resources()
- if a resource has a value of
"wms"
in the format
column it is available as a Web
Feature Service, and you can query and download it
using bcdc_query_geodata()
. The response will be
paginated if the number of features is above the number
set by the bcdata.single_download_limit
option.
Please see bcdc_options()
for defaults and more
information.
Usage
bcdc_query_geodata(record, crs = 3005)
Arguments
record |
either a It is advised to use the permanent ID for a record or the BCGW name rather than the
human-readable name to guard against future name changes of the record.
If you use the human-readable name a warning will be issued once per
session. You can silence these warnings altogether by setting an option:
|
crs |
the epsg code for the coordinate reference system. Defaults to
|
Details
Note that this function doesn't actually return the data, but rather an
object of class bcdc_promise
, which includes all of the information
required to retrieve the requested data. In order to get the actual data as
an sf
object, you need to run collect()
on the bcdc_promise
. This
allows further refining the call to bcdc_query_geodata()
with filter()
and/or select()
statements before pulling down the actual data as an sf
object with collect()
. See examples.
Value
A bcdc_promise
object. This object includes all of the information
required to retrieve the requested data. In order to get the actual data as
an sf
object, you need to run collect()
on the bcdc_promise
.
Examples
# Returns a bcdc_promise, which can be further refined using filter/select:
try(
res <- bcdc_query_geodata("bc-airports", crs = 3857)
)
# To obtain the actual data as an sf object, collect() must be called:
try(
res <- bcdc_query_geodata("bc-airports", crs = 3857) %>%
filter(PHYSICAL_ADDRESS == 'Victoria, BC') %>%
collect()
)
try(
res <- bcdc_query_geodata("groundwater-wells") %>%
filter(OBSERVATION_WELL_NUMBER == "108") %>%
select(WELL_TAG_NUMBER, INTENDED_WATER_USE) %>%
collect()
)
## A moderately large layer
try(
res <- bcdc_query_geodata("bc-environmental-monitoring-locations")
)
try(
res <- bcdc_query_geodata("bc-environmental-monitoring-locations") %>%
filter(PERMIT_RELATIONSHIP == "DISCHARGE")
)
## A very large layer
try(
res <- bcdc_query_geodata("terrestrial-protected-areas-representation-by-biogeoclimatic-unit")
)
## Using a BCGW name
try(
res <- bcdc_query_geodata("WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW")
)