A useful workflow for raster data in a memory bounded environment is to chunk a grid into sections or tiles. These functions compute tiles suitable for such processing. Use grd_tile_summary() to generate statistics for level values to choose for your application.

grd_tile_template(grid, level)

grd_tile_summary(grid, levels = NULL)

Arguments

grid

A grd_xy(), grd_rct(), or other object implementing grd_*() methods.

level

An integer describing the overview level. This is related to the step value by a power of 2 (i.e., a level of 1 indicates a step of 2, a level of 2 indicates a step of 4, etc.).

levels

A vector of level values or NULL to use a sequence from 0 to the level that would result in a 1 x 1 grid.

Value

A grd()

Examples

grid <- grd_rct(volcano)
grd_tile_summary(grid)
#>   level xmin ymin xmax ymax nx ny dx  dy width height
#> 1     0    0    0   61   87 61 87  1   1    61     87
#> 2     1    0   -1   62   87 31 44  2   2    62     88
#> 3     2    0   -1   64   87 16 22  4   4    64     88
#> 4     3    0   -1   64   87  8 11  8   8    64     88
#> 5     4    0   -9   64   87  4  6 16  16    64     96
#> 6     5    0   -9   64   87  2  3 32  32    64     96
#> 7     6    0  -41   64   87  1  2 64  64    64    128
#> 8     7    0  -41   64   87  1  1 64 128    64    128
grd_tile_template(grid, 3)
#> <wk_grd_rct [11 x 8 x 0] => [0 -1 64 87]>
#> List of 2
#>  $ data: logi[1:11, 1:8, 0 ] 
#>  $ bbox: wk_rct[1:1] [0 -1 64 87]
#>  - attr(*, "class")= chr [1:2] "wk_grd_rct" "wk_grd"