Unlimited learning, half price | 50% off

Last chance! 50% off unlimited learning

Sale ends in


spatialEco (version 2.0-1)

rotate.polygon: Rotate polygon

Description

rotates polygon by specified angle

Usage

rotate.polygon(
  p,
  angle = 45,
  sp = FALSE,
  anchor = c("center", "lower.left", "upper.right")
)

Value

an sp or sf polygon object with rotated polygon

Arguments

p

A polygon object of sf or sp class

angle

Rotation angle in degrees

sp

(FALSE | TRUE) Output sp class object

anchor

Location to rotate polygon on options are "center", "lower.left" and "upper.right"

Examples

Run this code
library(sf)
 
data(meuse, package = "sp")
  meuse <- st_as_sf(meuse, coords = c("x", "y"), 
                    crs = 28992, agr = "constant")
 
 e <- st_convex_hull(st_union(meuse))
   e30 <- rotate.polygon(e, angle=30)
 
 plot(e, main="rotated 30 degrees")
   plot(e30, add=TRUE)
 

Run the code above in your browser using DataLab