readDataByTile: Read raster data for a certain tile

View source: R/SOptim_RasterTiling.R

readDataByTileR Documentation

Read raster data for a certain tile

Description

An ancilary function that uses an SOptim.Tiles object (generated by [createRasterTiles()]) and reads pixel-level data to a matrix or data.frame.

Usage

readDataByTile(rst, tiles, nd = 2, tileIndex = NULL, as.df = TRUE)

Arguments

rst

A SpatRaster object.

tiles

A SOptim.Tiles object (generated by createRasterTiles. If not provided, a SOptim.Tiles will be generated on-the-fly with nd^2 tiles.

nd

Number of times to slice the SpatRaster across row and column direction. The total number of tiles will be given by: N_{tiles} = nd^{2}. (default: 2)

tileIndex

Tile index to read (default: NULL)

as.df

Return a data.frame object? (default: TRUE)

Value

A matrix or data.frame containing pixel-level data for the whole tile. If the input is a SpatRaster then each column represents each layer.


joaofgoncalves/SegOptim documentation built on Feb. 5, 2024, 11:10 p.m.