penvs_drawBgExtent: penvs_drawBgExtent: Draw background extent

View source: R/penvs_drawBgExtent.R

penvs_drawBgExtentR Documentation

penvs_drawBgExtent: Draw background extent

Description

This function generates a background area according to a user drawn polygon and provided buffer.

Usage

penvs_drawBgExtent(
  polyExtXY,
  polyExtID,
  drawBgBuf,
  occs,
  logger = NULL,
  spN = NULL
)

Arguments

polyExtXY

coordinates of polygon endpoints obtained from user drawn polygon in GUI.

polyExtID

numeric. ID to be used in the generation of the polygon.

drawBgBuf

the buffer to be used in generating the SpatialPolygonsDataFrame, maybe be 0 or >0. A number must be specified.

occs

data frame of cleaned or processed occurrences obtained from components occs: Obtain occurrence data or, poccs: Process occurrence data.

logger

Stores all notification messages to be displayed in the Log Window of Wallace GUI. Insert the logger reactive list here for running in shiny, otherwise leave the default NULL.

spN

data frame of cleaned occurrences obtained from component occs: Obtain occurrence data. Used to obtain species name for logger messages.

Details

This function is used in the select study region component. Here, in the GUI, the user draws a polygon to be used as the background extent and may include a buffer to the given polygon. The buffered poylgon must include all occurrences (occs) or function will return an error. The function returns a SpatialPolygonsDataFrame object of the desired extent (+ buffer).

Value

This functions returns a SpatialPolygons object based on the user specified coordinates (drawn on map). This SpatialPolygons object may be larger than specified if drawBgBuf > 0. The SpatialPolygons object will include all occurrences.

Author(s)

Jamie Kass <jamie.m.kass@gmail.com>

Gonzalo E. Pinilla-Buitrago <gepinillab@gmail.com>

Bethany A. Johnson <bjohnso005@citymail.cuny.edu>

See Also

penvs_userBgExtent, penvs_bgExtent, penvs_bgMask , penvs_bgSample

Examples

occs <- read.csv(system.file("extdata/Bassaricyon_alleni.csv",
                 package = "wallace"))[, 2:3]
occs$occID <- 1:nrow(occs)
longitude <- c(-27.78641, -74.09170, -84.01930, -129.74867,
               -142.19085, -45.55045, -28.56050)
latitude <- c(-40.40539, -37.02010, 2.28455, 40.75350,
              56.35954, 54.55045, -7.11861)
expertDrawPoly <- matrix(c(longitude, latitude), byrow = FALSE,
                         ncol = 2)
drawBgBf <- penvs_drawBgExtent(polyExtXY = expertDrawPoly, polyExtID = 1,
                               drawBgBuf = 0.5, occs)

wallace documentation built on Sept. 11, 2024, 9:16 p.m.