Create a prefixed number of non-overlapping sliding windows that cover the entire extent of a spatial object.
slideWindows(x, n = c(8, 8))
x | A spatial object where an extent can be extracted from.
Classes: |
---|---|
n | An integer vector of length two determining the number of divisions
in x and y directions. Default is |
An object of class slideWindows
, which consists of a list
of each sliding-windows extent.
# Example 1 p <- system.file('exdata', 'soybean.tif', package = 'hyperbrick') im <- brick(p) plotRGB(im) sw <- slideWindows(im, n = c(8, 8)) lapply(sw, lines) -> null_obj lines(sw[[1]], col = "white", lwd = 3) lines(sw[[64]], col = "white", lwd = 3) # Example 2 ext <- extent(c(30, 350, 150, 230)) lines(ext, col = "red", lwd = 3) sw2 <- slideWindows(ext, n = c(18, 6)) lapply(sw2, lines, col = "red") -> null_obj![]()