R package for retrieving data from the OBIS Web Services
devtools::install_github("pieterprovoost/robis")
Occurrences
Gridded taxon distribution
Bodiversity indices
Export
names <- c("Carcharodon carcharias", "Mola mola", "Ursus maritimus", "Aptenodytes forsteri")
data <- get_occurrences(names)
Finding species occurrences by AphiaID is considerably faster than by species name. AphiaIDs can be retrieved from WoRMS using taxizesoap or get_aphiaid.R.
data <- get_occurrences(137094)
Species:
data <- get_occurrences(409234, id="obis")
Higher level taxa (slow):
data <- get_occurrences(780806, id="obis", children=TRUE)
data <- get_occurrences("x739909x738303x741923x762719x766931
x766932x642142x778875x781762x778804x696387x752492x739483x769778x")
data <- get_occurrences("Carcharodon carcharias", bbox=c(-180,-20,180,20))
data <- get_occurrences("Abra alba",
filter=list(yearcollected=2010, institutioncode="Scottish Natural Heritage"))
# explicit where clause
data <- get_occurrences("Abra alba", where="monthcollected > 8")
map_occurrences(data)
data <- get_occurrences("Balaenoptera musculus",
where="resource_id = 22 or resource_id = 2553")
map_occurrences(data, color="resname")
m <- map_occurrences(data)
m + coord_quickmap(xlim = c(-20, 30), ylim=c(50, 60))
data <- get_distribution("Mola mola")
map_distribution(data)
data <- get_summaries()
map_summaries(data, "shannon")
data <- get_hexsummaries()
map_summaries(data, "shannon")
data <- get_hexsummaries(typeName = "hexgrid5")
data <- data[data$centre_latitude > -10,]
map_summaries(data, "es", style=style_jet(seq(0, 50, by=5))) +
coord_map("ortho", orientation=c(90, 0, 0)) +
theme(legend.position="right")
See here for an example file
library(devtools)
install_github("pieterprovoost/rwkt")
library(rwkt)
data <- get_occurrences(743268, id="obis", children=TRUE, maxFeatures=5)
geometry <- paste0("GEOMETRYCOLLECTION(", paste(data$geom, collapse=","), ")")
data <- data[,c("id", "yearcollected", "tname", "collectioncode")]
toGeoJSON(geometry, pretty=TRUE, data=data)
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
33.7082,
44.4106
]
},
"properties": {
"id": 149287642,
"yearcollected": 1996,
"tname": "Ampelisca diadema",
"collectioncode": "Laspibay-Black Sea"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
33.7072,
44.4096
]
},
"properties": {
"id": 149287011,
"yearcollected": 1996,
"tname": "Balanus improvisus",
"collectioncode": "Laspibay-Black Sea"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
11.109,
42.2386
]
},
"properties": {
"id": 146490918,
"yearcollected": 1999,
"tname": "Chthamalus stellatus",
"collectioncode": "pp"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
11.109,
42.2386
]
},
"properties": {
"id": 146490947,
"yearcollected": 2000,
"tname": "Balanus",
"collectioncode": "pp"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
11.109,
42.2386
]
},
"properties": {
"id": 146491001,
"yearcollected": 2001,
"tname": "Chthamalus stellatus",
"collectioncode": "pp"
}
}
]
}