get_gbif_records: Downloads GBIF records of species

View source: R/get_gbif_records.R

get_gbif_recordsR Documentation

Downloads GBIF records of species

Description

Downloads GBIF records of species, removing auxiliary columns and records recorded prior to a specified year, or that have coordinate uncertainty above a specified amount.

Usage

get_gbif_records(
  taxon,
  min_year,
  coord_uncertainty,
  basis_of_record,
  country,
  method = c("auto", "search", "download"),
  auto_threshold = 10000,
  username,
  pwd,
  email,
  retries = 10,
  cleanup = TRUE
)

Arguments

taxon

Character. Species taxonomic name.

min_year

Integer. The minimum year for which records should be collated. Default is NULL, i.e. no minimum.

coord_uncertainty

Integer. The maximum allowable documented coordinate uncertainty (in metres). If specified, this argument will result in removal of any records that have a documented uncertainty above this limit. Records with no uncertainty documented will be returned regardless of the value of coord_uncertainty.

basis_of_record

An optional character vector of one or more of: 'FOSSIL_SPECIMEN', 'HUMAN_OBSERVATION', 'LITERATURE', 'LIVING_SPECIMEN', 'MACHINE_OBSERVATION', 'MATERIAL_SAMPLE', 'OBSERVATION', 'PRESERVED_SPECIMEN', or 'UNKNOWN', giving the set of allowable values for the basis of observation.

country

An optional 2 letter ISO code defining the country within which occurrences should be contained. See https://www.iso.org/obp/ui/#search for valid ISO codes (see "Alpha-2 code") column.

method

Either 'search' (uses the GBIF /occurrence/search API endpoint), 'download' (uses the GBIF /occurrence/downloadAPI endpoint), or 'auto', which uses 'search' or 'download' based on occurrence count (i.e. dataset size). The 'search' method makes paginated queries to the API, while 'download' performs an asynchronous query (but waits for the resulting dataset to be ready for download). The 'search' method is limited to 100,000 records; for large datasets, consider using 'download' or 'auto'. When using 'download' or 'auto', the arguments username, pwd, and email must be provided. Default is 'auto'.

auto_threshold

Integer. If method is 'auto', this argument defines the occurrence count threshold defining whether the 'search' or 'download' method is used. Default is 10000, i.e. if fewer than 10000 records exist for the taxon, the 'search' method will be used. If 10000 or greater records, the 'download' method will be used. Ignored when method is not 'auto'.

username

GBIF username, required when method is 'download'.

pwd

GBIF password, required when method is 'download'.

email

Email address, required when method = 'download'. This may be used to notify user when download is ready.

retries

If method='download' and file download fails, how many additional attempts should be made to download the file?

cleanup

Logical. Should temporary files associated with 'download' and 'auto' method be deleted? Default is TRUE.

Details

This function is a wrapper of rgbif such that it can be readily used with the CoordinateCleaner package.

Value

A data.frame of species occurrence records.


jscamac/edmaps documentation built on June 11, 2022, 1:26 a.m.