This function retrieves the occurrence records of a species from the Global Biodiversity Information Facility (GBIF), with the public occurrence search API. No account and no API key are needed.
Only records with coordinates and without known geospatial issue are returned.
Arguments
- species
Character. Scientific name of the species, for instance
"Apodemus sylvaticus". Underscores are read as spaces, so the names ofocsge_species_dictandeunis_species_dictcan be used directly.- roi
An
sf(orsfc) object defining the Region Of Interest, in any projection. The search is made on its bounding box, then only the records insideroiare kept. WithNULL(default), the search is made on the whole world.- limit
Integer. Maximum number of records to download. Default is 1000. The API does not return more than 100,000 records for one search (see Details).
- ...
Other filters of the GBIF occurrence search API, as named arguments. For instance
year = "2000,2024",coordinateUncertaintyInMeters = "0,100",basisOfRecord = "HUMAN_OBSERVATION"orcountry = "FR". A range is written"min,max".- api_url
Character. Base URL of the GBIF API. Exposed mainly for testing against a different endpoint.
Value
An sf object of points in EPSG:4326, one row for
each record, with the columns:
- key
GBIF identifier of the record (
https://www.gbif.org/occurrence/<key>).- species
Scientific name of the species.
- coordinateUncertaintyInMeters
Uncertainty of the position, in meters. Often
NA.- eventDate, year
Date and year of the observation.
- basisOfRecord
Type of record, for instance
"HUMAN_OBSERVATION"or"PRESERVED_SPECIMEN".- datasetKey
GBIF identifier of the dataset (
https://www.gbif.org/dataset/<datasetKey>).- license
License of the record.
The total number of records matching the search in GBIF is stored in the
attribute "gbif_count".
Details
The name is first matched against the GBIF taxonomy
(species/match), then the records are downloaded by pages of 300
(occurrence/search).
Limitations:
The search API stops at 100,000 records. For a larger request, split the region of interest, or the years with
year.The search API gives no DOI. For a publication, GBIF asks to cite a download: see https://www.gbif.org/citation-guidelines and the function
occ_download()of the 'rgbif' package.GBIF records are opportunistic observations. They show where the species was seen, not where it is absent, and the position can be uncertain by several kilometers.
See also
get_eunis_data and get_ocsge for the
land cover of the same region of interest.
Examples
if (FALSE) { # \dontrun{
data("roi_metaleurop")
occ <- get_gbif_data("Apodemus sylvaticus", roi = roi_metaleurop)
plot(sf::st_geometry(occ))
# recent records with a position known within 100 m
occ <- get_gbif_data("Apodemus sylvaticus", roi = roi_metaleurop,
year = "2000,2024",
coordinateUncertaintyInMeters = "0,100")
} # }