Learn R Programming

spatialEco (version 1.3-5)

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")
)

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"

Value

an sp or sf polygon object with rotated polygon

Examples

Run this code
# NOT RUN {
library(sp)
library(rgeos)

data(meuse)
  coordinates(meuse) <- ~x+y

e <- gConvexHull(meuse)
  e30 <- rotate.polygon(e, angle=30, sp=TRUE)

plot(e, main="rotated 30 degrees")
  plot(e30, add=TRUE)

# }

Run the code above in your browser using DataLab