plot_obis: Function to extract and map obis records

Description Usage Arguments Value Examples

Description

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.

Usage

1
2
3
plot_obis(scientificname, year = NULL, shapefile = NULL, area.x = NULL,
  area.y = NULL, myzoom = 7, lat_centre = NULL, lon_centre = NULL,
  gridded = F, myresolution = 0.5)

Arguments

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 plot_obis looks for records. Coordinates must be provided following the shape of the area clockwise, see example. If NULL the function returns all available records.

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

Value

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.

Examples

 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

MarineEcosystemResearchProgramme/merpWS documentation built on May 7, 2019, 2:51 p.m.