squareBuffer: Square buffer

View source: R/squareBuffer.R

squareBufferR Documentation

Square buffer

Description

Creates a square buffer of a feature class

Usage

squareBuffer(x, a, ...)

Arguments

x

An sf object

a

Numeric single or vector indicating buffer distance(s)

...

Additional arguments passed to st_buffer

Details

Function creates a square buffer of feature class.

Value

A single feature sf class polygon object

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

library(sf)
xy <- st_as_sf(data.frame(x = c(1,3,6,7),
               y = c(3,2,7,8), z = c(38,23,12,12),
               area = c(32,23,45,67)),
			      coords = c("x", "y"), 
			      agr = "constant") 

# With fixed buffer
sb <- squareBuffer(xy, 32)
  plot(st_geometry(sb))
    plot(st_geometry(xy), pch=20, add=TRUE)
  
# With variable buffer
sb.var <- squareBuffer(xy, xy$area)
  plot(st_geometry(sb.var))
    plot(st_geometry(xy), pch=20, add=TRUE)
  

spatialEco documentation built on Nov. 18, 2023, 1:13 a.m.