Rotate geometric objects by a certain angle about center coordinates
gt_rotate(obj, x = NULL, y = NULL, angle = NULL, fid = NULL, update = TRUE)
obj | [ |
---|---|
x | [ |
y | [ |
angle | [ |
fid | [ |
update | [ |
geom
of the rotated obj
.
Other geometry tools:
gt_filter()
,
gt_locate()
,
gt_pull()
,
gt_reflect()
,
gt_scale()
,
gt_skew()
,
gt_stretch()
,
gt_translate()
# rotate all geoms visualise(gtGeoms$polygon, linewidth = 3) newPoly <- gt_rotate(obj = gtGeoms$polygon, x = 0, y = 0, angle = 135, update = FALSE) visualise(geom = newPoly, linecol = "green", new = FALSE) # rotate a single geom visualise(gtGeoms$polygon, linewidth = 3) newPoly <- gt_rotate(obj = gtGeoms$polygon, x = -10, y = 0, angle = -180, update = FALSE, fid = 2) visualise(geom = newPoly, linecol = "green", new = FALSE) # rotate different geoms about different centers by different angles visualise(gtGeoms$polygon, linewidth = 3) newPoly <- gt_rotate(obj = gtGeoms$polygon, x = c(0, -10), y = c(-10, 0), angle = c(75, -135), update = FALSE) visualise(geom = newPoly, linecol = "green", new = FALSE)