Compute a resolution in the original map units that conforms to given criteria.

resolution(x, max_ncells = 100)

Arguments

x

a Raster* or Spatial* object

max_ncells

Number of cells for the largest dimension

Value

A number. The resolution that respects the desired number of cells.

Examples

r <- raster::raster(nrows = 5, ncols = 11, xmn = 0, xmx = 11, ymn = 0, ymx = 5) resolution(r, max_ncells = 10)
#> [1] 1.1