st_rotate: Rotate a simple feature

View source: R/geometry.R

st_rotateR Documentation

Rotate a simple feature

Description

Rotate a simple feature

Usage

st_rotate(x, r = pi/2, degrees = FALSE)

Arguments

x

sf object

r

numeric, radians (or degrees) to rotate. Must be of length 1 (in which case the value is recycled) or length equal to the number of rows in x

degrees

logical, if TRUE intepret r as degrees instead of radians

Value

a rotated version of the input x

See Also

https://r-spatial.github.io/sf/articles/sf3.html#affine-transformations-1

Examples

## Not run: 
 v <- volcano_multi(what = 'bands')
 x <-  volcano_polygon()
 x2 <- st_rotate(x, -pi/8)
 plot(v[,,,1], reset = FALSE)
 plot(sf::st_geometry(x), add = TRUE, border = "purple", col = NA, lwd = 3)
 plot(sf::st_geometry(x2), add = TRUE, border = "orange", col = NA, lwd = 3)

## End(Not run)

BigelowLab/twinkle documentation built on Jan. 26, 2025, 6:34 a.m.