Interface to the 'USGS' 'BISON' API

Interface to the 'USGS' 'BISON' (< https://bison.usgs.gov/>) API, a 'database' for species occurrence data. Data comes from species in the United States from participating data providers. You can get data via 'taxonomic' and location based queries. A simple function is provided to help visualize data.


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

Wrapper for the USGS Bison API

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, U.S. Territories, U.S. Marine Exclusive Economic Zones (EEZs), and Canada. 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/doc/api.jsp 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
#> [1] 7

map occurrences

bisonmap(out)

plot of chunk unnamed-chunk-7

All points within the US (including AK and HI)

get data

out <- bison(species = "Cyanocitta stelleri", count = 500)

inspect summary

out$summary
#> $fossil
#> [1] 2
#> 
#> $observation
#> [1] 566346
#> 
#> $centroid
#> [1] 1
#> 
#> $specimen
#> [1] 3294
#> 
#> $unknown
#> [1] 208

map occurrences

bisonmap(out)

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
#> $literature
#> [1] 1641
#> 
#> $fossil
#> [1] 642
#> 
#> $observation
#> [1] 128811
#> 
#> $centroid
#> [1] 1
#> 
#> $unknown
#> [1] 9734
#> 
#> $specimen
#> [1] 1899

map occurrences

bisonmap(out)

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

States - using last data call for Aquila

bisonmap(out, tomap = "state")

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

occurrence search

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 = "Aquila chrysaetos", rows = 10, 
    fl = "scientificName,decimalLongitude,decimalLatitude")
x$points
#>    decimalLongitude    scientificName decimalLatitude
#> 1         -117.6185 Aquila chrysaetos        33.71447
#> 2         -117.6185 Aquila chrysaetos        33.71447
#> 3         -117.6185 Aquila chrysaetos        33.71447
#> 4         -117.6185 Aquila chrysaetos        33.70987
#> 5         -117.6014 Aquila chrysaetos        33.65099
#> 6         -117.4997 Aquila chrysaetos        33.68344
#> 7         -117.4544 Aquila chrysaetos        33.65246
#> 8         -117.4544 Aquila chrysaetos        33.65246
#> 9         -117.4543 Aquila chrysaetos        34.02910
#> 10        -117.4543 Aquila chrysaetos        34.02910

Mapping the data

out <- bison_solr(scientificName = "Aquila chrysaetos", rows = 1000)
bisonmap(out)

plot of chunk unnamed-chunk-19

Meta

  • Please report any issues or bugs.
  • License: MIT
  • Get citation information for rbison in R doing citation(package = 'rbison')
  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

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

News

rbison 0.7.0

NEW FEATURES

  • bison() pagination: previous max as far as we knew was 500 per a single request, but apparently is now 1000. In addition, we no loop internally over the count parameter so that requests larger than 1000 are handled with a while loop until we get all the data requested (#58)
  • to simplify bison() the what parameter is defunct/removed. It let the user pick what part of the results they wanted, but it is super simple to do this once the data is returned. (#59)

MINOR IMPROVEMENTS

  • clean up description of USGS BISON in README (#56) thanks @esellers-usgs
  • tests now caching HTTP requests via vcr (#61)
  • changed internal processing of the occurrence records output in the points slot of the bison() function. previously we were filtering the records to only those with lat and lon values. now we return all. this means some records may not have lat/lon data, and may have other missing data. along with this, now importing data.table (#60)

BUG FIXES

  • fixed bug in bisonmap() that was causing a problem when a state was given in the bison() call that was passed to bisonmap(tomap = "county"); maps were not right, fixed now (#57) thanks @bomeara

rbison 0.6.0

NEW FEATURES

  • rbison::bison_solr now supports range queries for certain parameters. It doesn't make sense to do a range query for a character string parameter (e.g., range between Asteraceae and Juncaceae), but you can do them for any parameters that are numeric/integer/date. See examples in ?bison_solr. (this was added originally to facilitate date based searching in spocc) (#53)

MINOR IMPROVEMENTS

  • Added some missing parameters to bison_solr(), e.g., ITISscientificName, higherGeographyID, and countryCode. See ?bison_solr for details. (#54)
  • Updated docs for count parameter in bison(): default is now 25, and max is 500. Also, default for start set to 0, so we pass that by default now. We check to make sure count is not greater than 500 since the BISON API does not fail gracefully if it is greater than 500.

rbison 0.5.4

NEW FEATURES

  • now using crul http client instead of httr (#47)

MINOR IMPROVEMENTS

  • put readme images in tools/ dir as requested by CRAN (#48)
  • tidy docs and code to 80 line width (#49)
  • use markdown docs (#50)

rbison 0.5.0

MINOR IMPROVEMENTS

  • Replace dplyr::rbind_all() with dplyr::bind_rows() (#39)
  • Base URLs changd for the BISON API (#34) (#43)
  • Fixed a URL in the docs (#44) thanks @esellers-usgs

BUG FIXES

  • Fixes for a new ggplot2 version in mapping function rbison::bisonmap() (#38)

rbison 0.4.8

MINOR IMPROVEMENTS

  • Now explicitly importing all non-base R package functions that ship with R, in this case from stats and methods packages (#36)
  • .Rbuildignore the vignettes/figure directory (#37)
  • Using @importFrom across all package imports.
  • The query parameter in bison_tax() is now required.
  • Startup message is gone.
  • Changed to new base URLs for BISON APIs.

rbison 0.4.5

MINOR IMPROVEMENTS

  • Fixes for \donttest.
  • Removed dependency on assertthat.
  • Sentence Case the Title in the DESCRIPTION file!!!!!!
  • Fixed a test for the bisonmap() function.

rbison 0.4.3

NEW FEATURES

  • New function bison_stats() to query the statistics about BISON downloads.
  • New function citation_datause() to get information on data use rules, and citation for using BISON data.
  • New vignette other_functions that goes over the other functions in rbison. The main vignette covers bison() only.

BUG FIXES

  • Changed output of all data to have stringsAsFactors=FALSE.

MINOR IMPROVEMENTS

  • Changed all callopts parameters to ..., so you can pass in named options to httr::GET calls instead of through callopts, except in functions that interact with a SOLR engine, in which case ... is reserved for passing on additional SOLR parameters, and then callopts is still used.
  • No longer importing data.table, importing dplyr now, and assertthat
  • Changed to MIT license.
  • Changed to jsonlite from rjson for JSON parsing.
  • bison() loses parameter itis, as it only has one possible value; gains parameter params that accepts further parameters to modify the search; changed parameter callopts to ....
  • Add many examples of using the params parameter in the bison() function.
  • Changed parameter callopts to ... in bison_providers().
  • Changed parameter callopts to ... in bison_tax().
  • In bison_solr(): BISONProviderID changed to providerID; BISONResourceID changed to resourceID; occurrence_date changed to eventDate; collector changed to recordedBy; gains parameters catalogNumber, ITIScommonName, kingdom, and verbose. Adde a bunch of examples.
  • Startup message contains reference to citation function.

rbison 0.3.2

BUG FIXES

  • Changed blanktheme() function to bison_blanktheme() to avoid namespace conflicts with the rgbif package.

rbison 0.3.0

NEW FEATURES

  • Added a vignette.
  • bison() function gains "what" parameter, to allow selection of the type of data to get back. All data is returned from the API (As there is no way to select subsets of data), but the what parameter lets you discard the things you don't want, saving on memory.
  • bison() function gains "callopts" parameter to pass on curl options to httr::GET
  • bison() function gains "itis" parameter. Setting to TRUE allows searches on ITIS taxonomic serial numbers (TSNs)
  • bison() function gains "tsn" parameter. Specify a
  • New function bison_providers() to get metadata on data providers to BISON.

MINOR IMPROVEMENTS

  • bison_data() function removed. This function was used to get data back from a call to bison() or bison_solr(). Now those two functions simply give the data back immediately.
  • A startup message added.

rbison 0.2.4

NEW FEATURES

  • Pushed first version to CRAN.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("rbison")

0.7.0 by Scott Chamberlain, 5 months ago


https://github.com/ropensci/rbison


Report a bug at https://github.com/ropensci/rbison/issues


Browse source code at https://github.com/cran/rbison


Authors: Scott Chamberlain [aut, cre]


Documentation:   PDF Manual  


Task views:


MIT + file LICENSE license


Imports plyr, crul, ggplot2, mapproj, grid, sp, dplyr, jsonlite, data.table

Suggests roxygen2, knitr, testthat, taxize, vcr


Imported by spocc.


See at CRAN