powered by
Given a raster object, an extent, or a bounding box, a raster of with square cells and having the extent and number of cells specified is returned.
# S4 method for matrix squareRaster(x,cells=NULL, buffer=0) # S4 method for SpatRaster squareRaster(x,cells=NULL, buffer=0) # S4 method for SpatVector squareRaster(x,cells=NULL, buffer=0) # S4 method for SpatExtent squareRaster(x,cells=NULL, buffer=0)
A SpatRaster with square cells
SpatRaster
A spatial object
The number of cells in the x direction. If NULL the number of columns of x is used.
Additional area to add around the resulting raster
myraster = rast(matrix(0,10,10),extent=c(0,10,0,12.3)) squareRaster(myraster) squareRaster(myraster, buffer=3, cells=20) squareRaster(ext(myraster), cells=10)
Run the code above in your browser using DataLab