# \donttest{
try(
crd <- bcdc_query_geodata("regional-districts-legally-defined-administrative-areas-of-bc") %>%
filter(ADMIN_AREA_NAME == "Cariboo Regional District") %>%
collect()
)
try(
ret1 <- bcdc_query_geodata("bc-wildfire-fire-perimeters-historical") %>%
filter(FIRE_YEAR == 2000, FIRE_CAUSE == "Person", INTERSECTS(crd)) %>%
collect()
)
# Use local() to force parts of your call to be evaluated in R:
try({
# Create a bounding box around two points and use that to filter
# the remote data set
library(sf)
two_points <- st_sfc(st_point(c(1164434, 368738)),
st_point(c(1203023, 412959)),
crs = 3005)
# Wrapping the call to `st_bbox()` in `local()` ensures that it
# is executed in R to make a bounding box that is then sent to
# the server for the filtering operation:
res <- bcdc_query_geodata("local-and-regional-greenspaces") %>%
filter(BBOX(local(st_bbox(two_points, crs = st_crs(two_points))))) %>%
collect()
})
# }
Run the code above in your browser using DataLab