get_gbif | R Documentation |
Get new occurrence record set from GBIF and save as .rds
. GBIF is the
Global Biodiversity Information Facility.
get_gbif(
aoi = NULL,
save_dir = NULL,
get_new = FALSE,
data_map = NULL,
predicates = NULL,
request_wait = 20,
name = "gbif",
filter_inconsistent = TRUE,
filter_NA_date = TRUE,
occ_char = TRUE,
adj_spa_rel = TRUE,
previous_key = NULL,
...
)
aoi |
sf defining area of interest. |
save_dir |
Character. File path into which to save outputs. If |
get_new |
Logical. If |
data_map |
Dataframe or |
predicates |
List. Any number of gbif predicates |
request_wait |
Integer. Time in seconds to wait between
|
name |
Character or |
filter_inconsistent |
Logical. If |
filter_NA_date |
Logical. Filter if |
occ_char |
Logical. If true, occ_derivation will be coerced to character (to match other data sources). |
adj_spa_rel |
Logical. If true, an attempt will be made to check
|
previous_key |
Character. e.g. |
... |
Passed to |
Uses various rgbif
functions
to return a dataframe of occurence records. Requires
gbif credentials.
Any arguments to rgbif::occ_download()
can be passed via extra_prediates
.
For convenience, aoi
can also be passed directly and internally it is
converted to a bounding box in appropriate lat/long and passed to
rgbif::pred_within()
in WKT format.
Dataframe of occurrences, full download (as key.zip) in save_dir
and file saved to save_dir
as gbif.parquet
.
# setup -------
library("envImport")
# no aoi ------
out_dir <- file.path(system.file(package = "envImport"), "examples", "get_gbif_ex")
gbif_data <- get_gbif(save_dir = out_dir
, get_new = FALSE
#, data_map = envImport::data_map
, predicates = rgbif::pred_and(rgbif::pred("taxonKey", 2474903)
, rgbif::pred("year", 2000)
)
, previous_key = "0057516-240626123714530"
)
# 667 records 2024-08-09
nrow(gbif_data)
head(gbif_data)
# with aoi
out_dir <- file.path(system.file(package = "envImport"), "examples", "get_gbif_aoi_ex")
gbif_data <- get_gbif(save_dir = out_dir
, aoi = envClean::aoi
, data_map = envImport::data_map
, get_new = FALSE
, predicates = rgbif::pred("year", 2000)
)
# 107 records 2024-08-09
nrow(gbif_data)
# .bib created
readr::read_lines(fs::path(out_dir, "gbif", "gbif.bib"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.