Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

GDALRasterBand-class

Class "GDALRasterBand"


Description

Returns a two-dimensional array with data from a raster band, used internally within functions

Usage

getRasterData(dataset, band = NULL, offset = c(0, 0),
              region.dim = dim(dataset), output.dim = region.dim,
              interleave = c(0, 0), as.is = FALSE, list_out=FALSE) 

getRasterTable(dataset, band = NULL, offset = c(0, 0), 
  region.dim = dim(dataset))

getProjectionRef(dataset, OVERRIDE_PROJ_DATUM_WITH_TOWGS84 = NULL, enforce_xy = NULL)

getRasterBand(dataset, band = 1)

getRasterBlockSize(raster)

toSigned(x, base)

toUnSigned(x, base)

get_OVERRIDE_PROJ_DATUM_WITH_TOWGS84()
set_OVERRIDE_PROJ_DATUM_WITH_TOWGS84(value)

Arguments

dataset

An object inheriting from class 'GDALReadOnlyDataset'

band

The band number (1-based) to read from

offset

Number of rows and columns from the origin (usually the upper left corner) to begin reading from; presently ordered (y,x) - this may change

region.dim

The number of rows and columns to read from the dataset; presently ordered (y,x) - this may change

output.dim

Number of rows and columns in the output data; if smaller than region.dim the data will be subsampled

interleave

Element and row stride while reading data; rarely needed

as.is

If false, scale the data to its natural units; if the case of thematic data, return the data as factors

list_out

default FALSE, return array, if TRUE, return a list of vector bands

raster

An object of class GDALRasterBand

x

integer variable for conversion

base

If Byte input, 8, if Int16 or UInt16, 16

OVERRIDE_PROJ_DATUM_WITH_TOWGS84

logical value, default NULL, which case the cached option set by set_OVERRIDE_PROJ_DATUM_WITH_TOWGS84 is used. Ignored if the GDAL version is less than “1.8.0” or if the CPLConfigOption variable is already set

enforce_xy

(PROJ6+/GDAL3+) either use global setting (default NULL) or override policy for coordinate ordering easting/x as first axis, northing/y as second axis.

value

logical value to set OVERRIDE_PROJ_DATUM_WITH_TOWGS84

Details

getRasterData:

retrieves data from the dataset as an array or list of bands; will try to convert relevant bands to factor if category names are available in the GDAL driver when returning a list.

getRasterTable:

retrieves data from the dataset as data frame.

getProjectionRef:

returns the geodetic projection in Well Known Text format.

getRasterBand:

returns a raster band

getRasterBlockSize:

returns the natural block size of the raster band. Use this for efficient tiled IO.

toSigned:

used to convert a band read as unsigned integer to signed integer

toUnSigned:

used to convert a band read as signed integer to unsigned integer

Objects from the Class

Objects can be created by calls of the form new("GDALRasterBand", dataset, band).

Slots

handle:

Object of class "externalptr", from class "GDALMajorObject", used internally; not for public consumption

Extends

Class "GDALMajorObject", directly.

Methods

dim

signature(x = "GDALRasterBand"): ...

initialize

signature(.Object = "GDALRasterBand"): ...

Note

The OVERRIDE_PROJ_DATUM_WITH_TOWGS84 argument is used to revert GDAL behaviour to pre-1.8.0 status; from 1.8.0, any input datum may be discarded if the input also includes a towgs84 tag in conversion to the PROJ.4 representation, see https://trac.osgeo.org/gdal/ticket/4880 and https://lists.osgeo.org/pipermail/gdal-dev/2012-November/034550.html. The cached value of OVERRIDE_PROJ_DATUM_WITH_TOWGS84 will also be used in open.SpatialGDAL, sub.GDROD, and asGDALROD_SGDF, which do not have a suitable argument

Author(s)

Timothy H. Keitt, modified by Roger Bivand

See Also

Examples

logo <- system.file("pictures/logo.jpg", package="rgdal")[1]
x <- new("GDALReadOnlyDataset", logo)
plot(density(getRasterTable(x)$band1))
GDAL.close(x)

rgdal

Bindings for the 'Geospatial' Data Abstraction Library

v1.5-23
GPL (>= 2)
Authors
Roger Bivand [cre, aut] (<https://orcid.org/0000-0003-2392-6140>), Tim Keitt [aut], Barry Rowlingson [aut, ctb], Edzer Pebesma [ctb], Michael Sumner [ctb], Robert Hijmans [ctb], Daniel Baston [ctb], Even Rouault [cph, ctb], Frank Warmerdam [cph, ctb], Jeroen Ooms [ctb], Colin Rundel [ctb]
Initial release
2021-02-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.