Learn R Programming

geostatsp (version 2.0.6)

squareRaster-methods: 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 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)

Value

A SpatRaster with square cells

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

Examples

Run this code

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