squareRaster: Create a raster with square cells

Description Usage Arguments Value Examples

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

1
2
3
4
5
6
7
8
## S4 method for signature 'matrix'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'Raster'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'Spatial'
squareRaster(x,cells=NULL, buffer=0)
## S4 method for signature 'Extent'
squareRaster(x,cells=NULL, buffer=0)

Arguments

x

A bounding box from a SpatialPoints or SpatialPolygons object or an Extent from a Raster.

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 rasterLayer with square cells

Examples

1
2
3
4
5
6
7
myraster = raster(matrix(0,10,10),xmn=0,xmx=10,ymn=0,ymx=12.3)

squareRaster(myraster)

squareRaster(extent(myraster), cells=10)

squareRaster(bbox(myraster), cells=10)

geostatsp documentation built on Oct. 5, 2021, 9:10 a.m.