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

resolution(x, min_ncells = 100)

Arguments

x

a Raster* or Spatial* object

min_ncells

Number of cells for the smallest 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, min_ncells = 10)
#> [1] 0.5