# NOT RUN {
## read 5x5 pixel block with 10,10 offset
r.file <- system.file("pictures", "cea.tif", package="rgdal")
r <- arc.raster(arc.open(r.file))
v <- r$pixel_block(ul_x = 10L, ul_y = 10L, nrow = 5L, ncol= 5L)
stopifnot(length(v) == 25)
## process big raster
r2 = arc.raster(NULL, path=tempfile("r2", fileext=".img"),
dim=dim(r), pixel_type=r$pixel_type, nodata=r$nodata,
extent=r$extent,sr=r$sr)
for (i in 1L:r$nrow)
{
v <- r$pixel_block(ul_y = i - 1L, nrow = 1L)
r2$write_pixel_block(v * 1.5, ul_y = i - 1L, nrow = 1L, ncol = r$ncol)
}
r2$commit()
## resample raster
r <- arc.raster(arc.open(r.file), nrow=200L, ncol=200L, resample_type="BilinearGaussBlur")
## save to a different format
r$save_as(tempfile("new_raster", fileext=".img"))
## get and compare all pixel values
r.file <- system.file("pictures", "logo.jpg", package="rgdal")
rx <- raster::brick(r.file)
r <- arc.raster(arc.open(r.file))
stopifnot(all(raster::values(rx) == r$pixel_block()))
# }
Run the code above in your browser using DataLab