#' dobuff
#'
#' @description
#' Should not be called directly by users.
#' \code{dobuff} creates buffers around the central line.
#'
#' @param list.lines List with central lines (class SpatialLines) generated by \code{doline}.
#' @param faixa_dist Vector of plot survey widths.
#' @param buff_epsg EPSG code to use.
#'
#' @return List of buffers (SpatialPolygons) of the survey area for a plot.
#' @export
#'
#' @examples
#' \dontrun{
#' }
doBuff <- function(list.lines, faixa_dist = c(0.5, 1, 1.5, 2, 10, 20), buff_epsg = 3395) {
#
# area calcuado usando world projection, epsg 3395
require(sp)
require(rgdal)
require(rgeos)
mycrs <- paste("+init=epsg:", buff_epsg,sep="")
faixa_dist <- faixa_dist
l <- list.lines$SpatialLines_proj
mynames <- paste("buff", names(l),sep="_")
names(l) <- mynames
myline2 <- function(x) {
require(sp)
require(rgdal)
require(rgeos)
lsec <- gLineMerge(x, byid=FALSE, id = NULL)
dfb <- data.frame(bufnames = paste("buf_", faixa_dist,"m", sep=""),
faixa_dist = faixa_dist)
mb <- function(x, myl = lsec ){
require(sp)
require(rgdal)
require(rgeos)
gb <- gBuffer(myl, width=x$faixa_dist, capStyle="FLAT")
proj4string(gb) <- CRS(mycrs)
all_buff <- gb
}
buff_all <- plyr::dlply(dfb, c("bufnames"), .fun = mb)
}
outbuf <- lapply(l, FUN = myline2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.