Skip to contents

This function creates a polygon object from coordinates of user drawn poylgon in the GUI.

Usage

xfer_draw(polyXfXY, polyXfID, drawXfBuf, logger = NULL, spN = NULL)

Arguments

polyXfXY

coordinates of polygon endpoints obtained from user drawn polygon

polyXfID

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

drawXfBuf

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

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

character. Used to obtain species name for logger messages

Value

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

Details

This function is used in the transfer model component. In the GUI, the user draws a polygon to be used as the extent of transfer and may include a buffer to the given polygon. The function returns a SpatialPolygonsDataFrame object of the desired extent (+ buffer).

See also

Author

Gonzalo Pinilla <gepinillab@gmail.com>

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

Examples

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)
userDrawPoly <- matrix(c(longitude, latitude), byrow = FALSE,
                       ncol = 2)
drawXfBuf <- 0.5
polyXfID <- 1
polygonTest <- xfer_draw(polyXfXY = userDrawPoly, polyXfID,
                         drawXfBuf)
#> Draw polygon with buffer of 0.5 degrees.