st_tile | R Documentation |
Helper function for specifying the block parameters (nXOff
,
nYOff
, nXsize
, and nYSize
) required by RasterIO
argument in read_stars
st_tile(img_rows, img_cols, x_window, y_window, overlap = 0)
img_rows |
number of input raster rows (integer) |
img_cols |
number of input raster columns (integer) |
x_window |
number of rows in block (integer) |
y_window |
number of columns in block (integer) |
overlap |
number of overlapping pixels (integer) |
matrix with specified nXOff
, nYOff
, nXsize
,
and nYSize
parameters for every block
## Not run:
tif = system.file("tif/L7_ETMs.tif", package = "stars")
r = read_stars(tif, proxy = TRUE)
tiles = st_tile(nrow(r), ncol(r), 256, 256)
for (i in seq_len(nrow(tiles))) {
tile = read_stars(tif, proxy = FALSE, RasterIO = tiles[i, ])
# write tiles to separate files
write_stars(tile, dsn = paste0(i, ".tif"))
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.