mosaic_rotate | R Documentation |
This function rotates a mosaic image by 90, 180, or 270 degrees.
mosaic_rotate(mosaic, angle, direction = "clockwise")
mosaic |
A |
angle |
An integer specifying the rotation angle. Must be one of 90, 180, or 270. |
direction |
A string specifying the rotation direction. Must be either "clockwise" or "anticlockwise". |
A SpatRaster
object with the rotated mosaic image.
if (interactive() && requireNamespace("EBImage")) {
library(pliman)
# Convert a mosaic raster to an Image object
mosaic <- mosaic_input(system.file("ex/elev.tif", package="terra"))
r90 <- mosaic_rotate(mosaic, 90)
r180 <- mosaic_rotate(mosaic, 180)
r270 <- mosaic_rotate(mosaic, 270)
# Plot all rotations side by side
par(mfrow = c(2, 2))
mosaic_plot(mosaic, main = "Original")
mosaic_plot(r90, main = "90 Degrees")
mosaic_plot(r180, main = "180 Degrees")
mosaic_plot(r270, main = "270 Degrees")
par(mfrow = c(1, 1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.