Learn R Programming

rnbn (version 1.1.2)

getOccurrences: Get occurrences for a given species

Description

Gets occurrence data from the NBN to which you have access. To get access to data you must first register at https://data.nbn.org.uk/User/Register. You will need your username and password when running this function for the first time. You can specify the data to retrieve by dataset, species, time, location and/or group.

Usage

getOccurrences(tvks = NULL, datasets = NULL, startYear = NULL, endYear = NULL, VC = NULL, group = NULL, gridRef = NULL, polygon = NULL, point = NULL, radius = 5000, latLong = TRUE, acceptTandC = FALSE, silent = FALSE, attributes = FALSE, ...)

Arguments

tvks
a list of TVKs which are strings of 16 alphanumeric characters. You can look these up using getTVKQuery
datasets
a list of dataset keys which are strings of 8 alphanumeric characters. Look up datasets here: https://data.nbn.org.uk/Datasets
startYear
a 4 digit integer year
endYear
a 4 digit integer year
VC
a string giving a vice-county name (see listVCs)
group
a string giving the name of a group (see listGroups). Using group will retireve data for all TVKs in this group. for example using group 'reptile' will search using over 150 TVKs including TVKs for higher taxonomic groups such families within reptiles. Therefore it may be preferrable to search using a list TVKs aquired using getTVKQuery
gridRef
a string giving a gridreference in which to search for occurrences
polygon
A WKT (Well-Known Text) polygon string. Note that polygons containing many verticies (>100) are likely to create queries that exceed the NBN character limit
point
A vector of two numbers; latitude, longitude. Used with radius.
radius
A numeric distance, in meters used with point to create a circular search area.
latLong
logical, if TRUE latitude and longitude are returned as additional columns. The conversion to latitude and longitude is currently accurate to about about ~20 meters, greater than the vast majoring of records' precision.
acceptTandC
if set to TRUE you accept the NBN gateway terms and conditions and privacy policy. These can be found at https://data.nbn.org.uk/Terms. Accepting the terms and conditions supresses the corresponding warning message.
silent
If TRUE batch request information is supressed
attributes
If FALSE then attribute data is not returned, this may improve the speed of large requests.
...
Further named parameters passed on to GET

Value

a data.frame of occurence records. Details of the data providers that contributed to the data returned is given as a 'providers' attribute

See Also

getFeature, getTVKQuery, listVCs, listDatasets, listGroups

Examples

Run this code
## Not run:  
#  dt1 <- getOccurrences(tvks="NBNSYS0000002987", datasets="GA000373", 
#                        startYear="1990", endYear="1991")
#                       
#  dt2 <- getOccurrences(tvks=c("NBNSYS0000002987","NHMSYS0001688296","NHMSYS0000080210"),
#                        startYear="1990", endYear="1991")
#                        
#  dt3 <- getOccurrences(group="quillwort", startYear="1990", endYear="2010",
#                        VC="Shetland (Zetland)")
#  
#  # Get the data providers information
#  dp <- attr(dt1,'providers')                      
#                        
# ## End(Not run)

Run the code above in your browser using DataLab