map_extrapolation: Interactive maps of extrapolation

Description Usage Arguments Value Author(s) References Examples

View source: R/map_extrapolation.R

Description

Produces interactive html maps of extrapolation values in the prediction area. The function relies on the leaflet package (Cheng et al. 2018), and thus requires an internet connection (i.e. will not work offline).

Usage

1
2
3
4
5
6
7
8
map_extrapolation(
  map.type = NULL,
  extrapolation.object = NULL,
  base.layer = "ocean",
  sightings = NULL,
  tracks = NULL,
  verbose = TRUE
)

Arguments

map.type

Character string. Type of map to be returned. Either extrapolation for an extrapolation map, mic for a map of the most influential covariates, or nearby for a map of the percentage of data nearby.

extrapolation.object

List object as returned by compute_extrapolation or compute_nearby.

base.layer

Base layer used for mapping. The default is ocean, which uses the ESRI.OceanBasemap. Use world for ESRI.WorldImagery and gray for ESRI.WorldGrayCanvas. Available map tiles can be viewed at https://leaflet-extras.github.io/leaflet-providers/preview/.

sightings

Species observations (optional). Can be supplied as a matrix of coordinates, a data.frame, a SpatialPoints object or a SpatialPointsDataFrame object. Circle markers will be proportional to group size if the data contain a column labelled size.

tracks

Survey tracks (optional). Can be supplied as a matrix of coordinates, a data.frame, a SpatialLines object or a SpatialLinesDataFrame object. A TransectID field is required for matrix or data.frame inputs.

verbose

Logical. Show or hide possible warnings and messages.

Value

An interactive html map.

Author(s)

Phil J. Bouchet

References

Bouchet PJ, Miller DL, Roberts JJ, Mannocci L, Harris CM and Thomas L (2019). From here and now to there and then: Practical recommendations for extrapolating cetacean density surface models to novel conditions. CREEM Technical Report 2019-01, 59 p. https://research-repository.st-andrews.ac.uk/handle/10023/18509

Cheng J, Karambelkar B, Xie Y (2018). leaflet: Create Interactive Web Maps with the JavaScript 'Leaflet' Library. R package version 2.0.2. https://CRAN.R-project.org/package=leaflet

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
26
27
28
29
30
31
32
33
library(dsmextra)

# Load the Mid-Atlantic sperm whale data (see ?spermwhales)
data(spermwhales)

# Extract the data
segs <- spermwhales$segs
predgrid <- spermwhales$predgrid

# Define relevant coordinate system
my_crs <- sp::CRS("+proj=aea +lat_1=38 +lat_2=30 +lat_0=34 +lon_0=-73 +x_0=0
 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0")

 # Define covariates of interest
 my_cov <- c("Depth", "DistToCAS", "SST", "EKE", "NPP")

# Assess extrapolation in the multivariate space defined by five covariates
spermw.extrapolation <- compute_extrapolation(samples = segs,
      covariate.names = c("Depth", "DistToCAS", "SST", "EKE", "NPP"),
      prediction.grid = predgrid,
      coordinate.system = my_crs)

# Assess the percentage of data nearby
spermw.nearby <- compute_nearby(samples = segs,
                               prediction.grid = predgrid,
                               coordinate.system = my_crs,
                               covariate.names = my_cov,
                               nearby = 1)

# Generate maps
map_extrapolation(map.type = "extrapolation", extrapolation.object = spermw.extrapolation)
map_extrapolation(map.type = "mic", extrapolation.object = spermw.extrapolation)
map_extrapolation(map.type = "nearby", extrapolation.object = spermw.nearby)

densitymodelling/dsmextra documentation built on Feb. 12, 2022, 4:40 a.m.