#' expshiftSHP
#'
#' @description
#' Should not be called directly by users.
#' \code{expshiftSHP} Moves central line to geographic coordinates.
#'
#' @param res_list List with data, spatial lines and polygons generated by \code{area_calc}.
#' @param pcoords Data.frame with geographic coordinates of plot start point.
#' @param c_epsg EPSG code for projected buffers.
#'
#' @return Exports cental line shifted to geographic coordinates.
#' @export
#'
#' @examples
#' \dontrun{
#' }
expshiftSHP <- function(res_list = res_list, pcoords = pcoords, c_epsg = 3395){
require(sp)
require(rgdal)
mycrs <- paste("+init=epsg:", c_epsg,sep="")
mypn <- as.character(res_list$SpatialLines_wgs84$SpatialLinesAll$plot_id[1])
linename <- paste(mypn, "_linha_geo.shp", sep="")
# shift
require(raster)
s1 <- res_list$SpatialLines_wgs84$SpatialLinesAll # shift "SpatialLinesAll"
selC <- which(pcoords$PLOT_ID %in% s1$plot_id[1])
s2 <- raster::shift(s1, x = pcoords[selC, 'LONG'], y = pcoords[selC, 'LAT'])
# write shape
raster::shapefile(s2, filename = linename)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.