Downloads in rgbif
(occ_download
and friends) is undergoing an overhaul to support more complex queries and to properly support in
queries which are not currently supported. Any feedback on the new download interface would be great. These are breaking changes for the download functions, so we’ll release a new major version of rgbif
soon
See https://github.com/ropensci/rgbif/issues/362 for discussion
Install remotes::install_github("ropensci/rgbif@downloads-rework")
After installing, see ?occ_download
for examples and docs.
Here’s a brief example that should run quickly:
library(rgbif)
Construct predicates (pred
, pred_multi
, and preds
) don’t send the query to GBIF, they only construct a query statement. The default operator for pred()
is =
pred("taxonKey", 3119195) # taxonKey=3119195
pred("elevation", 5000, ">") # elevation > 5000
pred("geometry", "POLYGON((-14 42, 9 38, -7 26, -14 42))")
pred_multi("taxonKey", c(2977832, 2977901, 2977966, 2977835), "in")
pred_multi("basisOfRecord", c("MACHINE_OBSERVATION", "HUMAN_OBSERVATION"), "in")
preds(pred("year", 1989, "<="), pred("year", 2000, "="))
Pass any number of predicates to occ_download()
to run a download query
occ_download(pred("taxonKey", 3119195), pred("elevation", 5000, ">"))
From here it works as before …