gbifOccDownload: Download Occurrence Records from GBIF

View source: R/gbifDownload.R

gbifOccDownloadR Documentation

Download Occurrence Records from GBIF

Description

Function to query the occurrence download API of GBIF and retrieve matching records.

Usage

gbifOccDownload(
  user,
  pwd,
  email,
  curlopts = list(),
  body = NULL,
  pingtime = 5,
  tmploc = tempdir(),
  assf = TRUE,
  ...
)

Arguments

user

A character string containing a valid username associated with a GBIF account. If NULL then Sys.getenv('GBIF_USER') and getOptions('gbif_user') are searched for a value instead.

pwd

A character string containing a valid password associated with a GBIF account. If NULL then Sys.getenv('GBIF_PWD') and getOptions('gbif_pwd') are searched for a value instead.

email

A character string containing a valid email associated with a GBIF account. If NULL then Sys.getenv('GBIF_EMAIL') and getOptions('gbif_email') are searched for a value instead.

curlopts

List of named curl options passed on to occ_download.

body

A character scalar containing a syntactically valid JSON query to pass to the GBIF occurrence download API. If this is NULL then the arguments in ... are instead passed to the jsonOccFormulation to generate a query.

pingtime

An integer scalar giving the number of seconds to wait between pings to GBIF's servers to query the status of the data download.

tmploc

A character scalar providing the location to store temporary files created in the download (that are then deleted on completion).

assf

A logical scalar that if TRUE, converts the output of the occurrence record download to an sf object.

...

If body is NULL then these parameters are passed to the jsonOccFormulation to generate a query.

Value

An object of type gbifOcc that inherits from an sf object if assf is TRUE but otherwise directly inherits from a data.frame. In addition the object will have the following attributes:

DOI

A character scalar giving the DOI allocated to the data download.

citation

A character scalar giving the citation to use when referring to the dataset in published literature.

query

A jsonlite object containing the full query used to generate the download.

dataset

A data frame containing information on the constituent datasets used in the occurrence download.

Author(s)

Joseph D. Chipperfield, joechip90@googlemail.com

See Also

name_lookup, taxonLookup, jsonOccFormulation


joechip90/PaGAn documentation built on April 17, 2025, 4:05 p.m.