rbison

Build Status Build status codecov.io rstudio mirror downloads cran version

Wrapper for the USGS Bison API

Description

USGS Biodiversity Information Serving Our Nation (BISON) is a web-based federal mapping resource that provides access to georeferenced (those with latitude and longitude coordinates) and non-georeferenced data describing the occurrence or presence of terrestrial and aquatic species recorded or collected by a person (or instrument) at a specific time in the United States and its Territories. Each record in a species occurrence dataset available in BISON will typically consist of a scientific name (genus and specific epithet), a date, and one or more geographic references such as a state name, county name, and/or decimal latitude and longitude coordinates. In addition to these typical data fields, species occurrence datasets often include many other data fields that describe each species occurrence event in more detail.

rbison allows one to pull species occurrence data from these datasets, inspect species occurance summaries, and then map species occurance within the US, within the contiguous 48 states, and/or at county or state level.

Current data providers for BISON can be found at https://bison.usgs.gov/providers.jsp

See https://bison.usgs.gov/#api for API docs for the BISON API.

Installation

From CRAN

install.packages("rbison")

Or the development version from Github

install.packages("devtools")
devtools::install_github("ropensci/rbison")
library('rbison')

Load package

library("rbison")

Notice that the function bisonmap automagically selects the map extent to plot for you, being one of the contiguous lower 48 states, or the lower 48 plus AK and HI, or a global map. If some or all points outside the US, a global map is drawn, and throws a warning. . You may want to make sure the occurrence lat/long coordinates are correct.

get data

out <- bison(species = "Phocoenoides dalli dalli", count = 10)

inspect summary

out$summary
#>   specimen specimen.1
#> 1        7          7

map occurrences

bisonmap(out)
plot of chunk unnamed-chunk-7
plot of chunk unnamed-chunk-7

All points within the US (including AK and HI)

get data

out <- bison(species = "Bison bison", count = 300)

inspect summary

out$summary
#>   occurrences.legend.fossil occurrences.legend.observation
#> 1                       359                            927
#>   occurrences.legend.centroid occurrences.legend.specimen
#> 1                           1                         946
#>   occurrences.legend.unknown fossil observation centroid specimen unknown
#> 1                          6    359         927        1      946       6

map occurrences

bisonmap(out)
plot of chunk unnamed-chunk-10
plot of chunk unnamed-chunk-10

All points within the contiguous 48 states

get data

out <- bison(species = "Aquila chrysaetos", count = 300)

inspect summary

out$summary
#>   occurrences.legend.literature occurrences.legend.fossil
#> 1                          1641                       642
#>   occurrences.legend.observation occurrences.legend.centroid
#> 1                         128207                           1
#>   occurrences.legend.unknown occurrences.legend.specimen literature fossil
#> 1                       9734                        1899       1641    642
#>   observation centroid unknown specimen
#> 1      128207        1    9734     1899

map occurrences

bisonmap(out)
plot of chunk unnamed-chunk-13
plot of chunk unnamed-chunk-13

Map county or state level data

Counties - using last data call for Aquila

bisonmap(out, tomap = "county")
plot of chunk unnamed-chunk-14
plot of chunk unnamed-chunk-14

States - using last data call for Aquila

bisonmap(out, tomap = "state")
plot of chunk unnamed-chunk-15
plot of chunk unnamed-chunk-15

BISON SOLR interface

taxa

The taxa service searches for and gives back taxonomic names

bison_tax(query = "*bear")
#> $numFound
#> [1] 48
#> 
#> $names
#>       lc_vernacularName       vernacularName
#> 1  Louisiana black bear Louisiana black bear
#> 2            Sloth Bear           Sloth Bear
#> 3          grizzly bear         grizzly bear
#> 4              bear oak             bear oak
#> 5     yellow woollybear    yellow woollybear
#> 6            bear daisy           bear daisy
#> 7     banded woollybear    banded woollybear
#> 8    Asiatic black bear   Asiatic black bear
#> 9           Kodiak bear          Kodiak bear
#> 10     black-ended bear     black-ended bear
#> 
#> $highlight
#> NULL
#> 
#> $facets
#> NULL

And you can search by scientific name

bison_tax(query = "Helianthus*", method = "scientificName")
#> $numFound
#> [1] 212
#> 
#> $names
#>                       scientificName
#> 1              Discoaster helianthus
#> 2  Helianthus divaricatus latifolius
#> 3             Helianthus decapetalus
#> 4                Helianthus ambiguus
#> 5             Helianthus dowellianus
#> 6               Helianthus luxurians
#> 7               Helianthus arenicola
#> 8              Helianthus atrorubens
#> 9               Helianthus frondosus
#> 10   Helianthus nuttallii canadensis
#> 
#> $highlight
#> NULL
#> 
#> $facets
#> NULL

The occurrence service searches by scientific names and gives back occurrence data similar to data given back by the bison() function

Searching for data and looking at output

x <- bison_solr(scientificName = "Ursus americanus", rows = 10, 
    fl = "scientificName,decimalLongitude,decimalLatitude")
x$points
#>    decimalLongitude   scientificName decimalLatitude
#> 1          -92.8370 Ursus americanus        48.48344
#> 2         -150.5500 Ursus americanus        59.59000
#> 3         -150.5500 Ursus americanus        59.59000
#> 4         -149.6600 Ursus americanus        59.83000
#> 5         -124.0676 Ursus americanus        46.28618
#> 6         -121.5178 Ursus americanus        41.75872
#> 7         -143.4417 Ursus americanus        64.95393
#> 8         -109.6747 Ursus americanus        34.98864
#> 9         -123.4106 Ursus americanus        47.78021
#> 10        -116.1590 Ursus americanus        33.98085

Mapping the data

out <- bison_solr(scientificName = "Ursus americanus", rows = 200)
bisonmap(out)
plot of chunk unnamed-chunk-19
plot of chunk unnamed-chunk-19

Meta

This package is part of a richer suite called SPOCC Species Occurrence Data, along with several other packages, that provide access to occurrence records from multiple databases. We recommend using SPOCC as the primary R interface to rbison unless your needs are limited to this single source.

ropensci_footer