slice_raster_brick: Split a raster brick into tiles with user-specified pixel...

Description Usage Arguments Details Value

Description

split_brick_px divides a RasterBrick into an arbitrary number of pieces (tiles).

Usage

1
2
3
4
slice_raster_brick(brick, tile_w_px = 50L, tile_h_px = 50L,
  overlap = 0L, complete_image = TRUE, path = NULL,
  file_ext = "tif", d_type = "INT1U", write_only = FALSE,
  write_options = c("TFW=YES"), cl = NULL)

Arguments

brick

The RasterBrick to be split.

tile_w_px

The width of the output tiles in number of pixels/cells.

tile_h_px

The height of the output tiles in number of pixels/cells.

overlap

The number of pixels images should overlap. Default of 0 means no image overlap (i.e., no two tiles will contain the same pixel from the source image). The same overlap value will be used in both x and y directions.

complete_image

If TRUE and the tile size and overlap dimensions do not conform to covering the entire source RasterBrick, an additional row and column of tiles will be created that include the excluded pixels but do NOT respect the overlap value. If FALSE and the dimensions do not conform, the set of tiles will omit some pixels on the right and bottom side of the source RasterBrick.

path

Character specifying the directory to which the split tiles will be saved. If missing, the function will store the tiles in memory. If the path does not exist, it will be created.

file_ext

Extension for image file type of saved tiles.

d_type

Datatype of the tiles. Defaults to INT1U. See dataType for additional information.

write_only

If TRUE, tiles will not be retained in memory.

write_options

File writing options passed to writeRaster's options argument.

cl

A cluster object. Optional. This would generally be created using parallel::makeCluster or equivalent.

Details

This function is parallel-aware, using the same mechanism as used in the raster package. Specifically, if you start a cluster using beginCluster, then this function will automatically use that cluster. It is always a good idea to stop the cluster when finished, using endCluster.

Value

split_brick_px returns either a list of cropped raster brick tiles or, if write_only = TRUE, a list containing TRUE, an error message, or a warning message depending on whether the tile was successfully written to file. The list's length will be equal to the number of tiles, determined by the source image width/height in pixels and the out_x_px, out_y_px, and overlap argument values.


treysp/coolit documentation built on June 5, 2019, 5:16 p.m.