sites_by_species: Sites by species

Description Usage Arguments Value References Examples

Description

A data.frame is returned as grid cells by species with values in each cell being the number of occurrences of each species. No null (all zero) species should be returned. The coordinates returned are the TOP-LEFT corner of the grid cell.

Usage

1
2
sites_by_species(taxon, wkt, gridsize = 0.1, SPdata.frame = FALSE,
  verbose = nbn_config()$verbose)

Arguments

taxon

string: the identifier to get the species data from the nbn biocache. E.g. "genus:Macropus". See nbn_fields("occurrence_stored") for valid field names

wkt

string: Bounding area in Well Known Text (WKT) format. E.g. "POLYGON((-3 56,-4 56,-4 57,-3 57,-3 56))".

gridsize

numeric: size of output grid cells in decimal degrees. E.g. 0.1 (=~10km)

SPdata.frame

logical: should the output be returned as a SpatialPointsDataFrame of the sp package?

verbose

logical: show additional progress information? [default is set by nbn_config()]

Value

A dataframe or a SpatialPointsDataFrame containing the species by sites data. Columns will include longitude, latitude, and each species present. Values for species are record counts (i.e. number of recorded occurrences of that taxon in each grid cell). The guid attribute of the data frame gives the guids of the species (columns) as a named character vector

References

Associated web services: https://layers.nbnatlas.org/ws

http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Otters in Scotland based on a 0.1 degree grid
ss <- sites_by_species(taxon="genus:Leutra",wkt="POLYGON((-3 56,-4 56,-4 57,-3 57,-3 56))
",gridsize=0.1,verbose=TRUE)
head(ss[,1:6])
# equivalent direct POST webservice call:
# https://layers.nbnatlas.org/ws/sitesbyspecies?speciesq=genus:Viola&qname=data&
#  area=POLYGON((-3%2056,-4%2056,-4%2057,-3%2047,-3%2056))&bs=- https://records-ws.nbnatlas.org/
#  ws/&movingaveragesize=1&gridsize=0.1&sitesbyspecies=1

## get the guid of the first species (which is the third column of the data frame, since the
##  first two columns are longitude and latitude)
attr(ss,"guid")[1]

## End(Not run)
#@export

fozy81/NBN4R documentation built on May 19, 2019, 8:22 a.m.