Description Usage Arguments Value Examples
This is a wrapper for the occurrence function in the robis package that extracts obis data for a given taxa and plot its records on a map. The option of gridding the data is available.
1 2 3 |
shapefile |
is the shapefile of a region of interest, obtained using the function mr_shp in the package mregions. |
area.x |
is a vector of longitudes for the area of interest.
Alongside area.y it describes the shape of a polygon in which |
area.y |
is a vector of latitudes for the area of interest |
myzoom |
is the zoom to be applied to plot the gridded data on ggmap map |
lat_centre |
is the user-defined latitude the map will be centred on. Default to mean latitude of observations. |
lon_centre |
is the user-defined longitude the map will be centred on. Default to mean longitude of observations. |
gridded |
is a logical argument setting whether to grid extracted obis data. |
myresolution |
is the size of the cells the data is to be aggregated over |
plot_obis
returns a data.frame containing the extracted obis data
and a map showing occurrences. The region of interest can either be defined manually
as a polygon or by providing a shapefile.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | library(robis)
library(wellknown)
library(mregions)
library(rgeos)
# example 1: extract records for rectangular area. Provide coordinates for the contour of the area
# going clockwise and repeating the initial coordinates at the end to "close" the polygon
records <- plot_obis("Asterias rubens", area.x = c(-10, -10, 10, 10, -10), area.y = c(40, 60, 60, 40, 40),
myresolution = 0.5, myzoom = 5, gridded = T)
# examine the data
head(records$obis_data)
# plot the data
records$myplot
# example 2: extract records for an area of interest defined as a shapefile
uk_eez <- mr_shp("MarineRegions:eez", maxFeatures = NULL,
filter = "United Kingdom Exclusive Economic Zone")
# shapefiles can be so complex that the robis functions crash: simplify
# the shapefile using rgeos::gSimplify
uk_eez_simple <- SpatialPolygonsDataFrame(gSimplify(uk_eez, tol = 0.01, topologyPreserve = TRUE),
data = uk_eez@data)
records <- plot_obis("Asterias rubens", shapefile = uk_eez_simple,
myresolution = 0.5, myzoom = 5, gridded = T)
# examine the data
head(records$obis_data)
# plot the data
records$myplot
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.