Learn R Programming

gdalBindings (version 0.1.17)

GDALRasterBand: R6 Class GDALRasterBand wrapping

Description

Wrapping class for GDALRasterBand C++ API exporting GetBlockXSize, GetBlockYSize, ReadBlock, WriteBlock for better IO speed.

Arguments

Methods


Method new()

Creates a new GDALRasterBand

Usage

GDALRasterBand$new(band)

Arguments

band

The C++ pointer to the GDALRasterBandR object.

datatype

The GDALDataType for this band

Returns

An object of GDALRasterBand R6 class


Method ReadBlock()

Efficiently reads a raster block

Usage

GDALRasterBand$ReadBlock(iXBlock, iYBlock)

Arguments

iXBlock

Integer. The i-th column block to access. The iXBlock will be offset \( BLOCKXSIZE \times iXBlock \) from the origin.

iYBlock

Integer. The i-th row block to access. The iYBlock will be offset \( BLOCKYSIZE \times iYBlock \) from the origin.

Details

The returned Vector will be single dimensional with the length \( BLOCKXSIZE \times BLOCKYSIZE \). If you use matrix(, ncol=BLOCKXSIZE) the matrix returned will actually be transposed. You should either transpose it or you can calculate the indices using \( y \cdot xsize + x \)

Returns

RawVector for GDALDataType$GDT_Byte, IntegerVector for int types and NumericVector for floating point types.


Method WriteBlock()

Efficiently writes a raster block

Usage

GDALRasterBand$WriteBlock(iXBlock, iYBlock, buffer)

Arguments

iXBlock

Integer. The i-th column block to write. The iXBlock will be offset \( BLOCKXSIZE \times iXBlock \) from the origin.

iYBlock

Integer. The i-th row block to write. The iYBlock will be offset \( BLOCKYSIZE \times iYBlock \) from the origin.

buffer

RawVector/IntegerVector/NumericVector depending on the GDALDataType. This should be a 1D vector with size equal to raster \( BLOCKXSIZE \times BLOCKYSIZE \).

Details

The returned Vector will be single dimensional with the length \( BLOCKXSIZE \times BLOCKYSIZE \). If you use matrix(, ncol=BLOCKXSIZE) the matrix returned will actually be transposed. You should either transpose it or you can calculate the indices using \( y \cdot xsize + x \).

Returns

Nothing


Method GetBlockXSize()

Get the block width

Usage

GDALRasterBand$GetBlockXSize()

Returns

An integer indicating block width


Method GetBlockYSize()

Get the block height

Usage

GDALRasterBand$GetBlockYSize()

Returns

An integer indicating block height


Method GetXSize()

Get the band width

Usage

GDALRasterBand$GetXSize()

Returns

An integer indicating band width


Method CalculateStatistics()

Calculate statistics for the GDALRasterBand

Usage

GDALRasterBand$CalculateStatistics()

Returns

nothing


Method GetYSize()

Get the band height

Usage

GDALRasterBand$GetYSize()

Returns

An integer indicating band height


Method GetNoDataValue()

Get band no data value

Usage

GDALRasterBand$GetNoDataValue()

Returns

Numeric indicating no data value


Method GetRasterDataType()

Get band datatype

Usage

GDALRasterBand$GetRasterDataType()

Returns

Numeric indicating the datatype


Method clone()

The objects of this class are cloneable with this method.

Usage

GDALRasterBand$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.