squareRaster: Create a raster with square cells

squareRaster-methodsR Documentation

Create a raster with square cells

Description

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.

Usage

## S4 method for signature 'matrix'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'SpatRaster'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'SpatVector'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'SpatExtent'
squareRaster(x,cells=NULL, buffer=0)

Arguments

x

A spatial object

cells

The number of cells in the x direction. If NULL the number of columns of x is used.

buffer

Additional area to add around the resulting raster

Value

A SpatRaster with square cells

Examples


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)



geostatsp documentation built on May 29, 2024, 5:53 a.m.