1\name{GDALRasterBand-class}
2\docType{class}
3\alias{GDALRasterBand-class}
4\alias{getRasterData}
5\alias{getRasterTable}
6\alias{getProjectionRef}
7\alias{initialize,GDALRasterBand-method}
8\alias{dim,GDALRasterBand-method}
9\alias{getRasterBand}
10\alias{getRasterBlockSize}
11\alias{toSigned}
12\alias{toUnSigned}
13\alias{get_OVERRIDE_PROJ_DATUM_WITH_TOWGS84}
14\alias{set_OVERRIDE_PROJ_DATUM_WITH_TOWGS84}
15\title{Class "GDALRasterBand"}
16\description{Returns a two-dimensional array with data from a raster band, used internally within functions}
17\section{Objects from the Class}{
18Objects can be created by calls of the form \code{new("GDALRasterBand", dataset, band)}.
19
20}
21\section{Slots}{
22  \describe{
23    \item{\code{handle}:}{Object of class \code{"externalptr", from class "GDALMajorObject"}, used internally; not for public consumption }
24  }
25}
26\section{Extends}{
27Class \code{"GDALMajorObject"}, directly.
28}
29\section{Methods}{
30  \describe{
31    \item{dim}{\code{signature(x = "GDALRasterBand")}: ... }
32    \item{initialize}{\code{signature(.Object = "GDALRasterBand")}: ... }
33  }
34}
35\usage{
36getRasterData(dataset, band = NULL, offset = c(0, 0),
37              region.dim = dim(dataset), output.dim = region.dim,
38              interleave = c(0, 0), as.is = FALSE, list_out=FALSE)
39
40getRasterTable(dataset, band = NULL, offset = c(0, 0),
41  region.dim = dim(dataset))
42
43getProjectionRef(dataset, OVERRIDE_PROJ_DATUM_WITH_TOWGS84 = NULL, enforce_xy = NULL)
44
45getRasterBand(dataset, band = 1)
46
47getRasterBlockSize(raster)
48
49toSigned(x, base)
50
51toUnSigned(x, base)
52
53get_OVERRIDE_PROJ_DATUM_WITH_TOWGS84()
54set_OVERRIDE_PROJ_DATUM_WITH_TOWGS84(value)
55
56}
57\arguments{
58  \item{dataset}{An object inheriting from class 'GDALReadOnlyDataset'}
59  \item{band}{The band number (1-based) to read from}
60  \item{offset}{Number of rows and columns from the origin (usually the
61    upper left corner) to begin reading from; presently ordered (y,x) - this may change}
62  \item{region.dim}{The number of rows and columns to read from the
63    dataset; presently ordered (y,x) - this may change}
64  \item{output.dim}{Number of rows and columns in the output data; if
65    smaller than \code{region.dim} the data will be subsampled}
66  \item{interleave}{Element and row stride while reading data; rarely
67    needed}
68  \item{as.is}{If false, scale the data to its natural units; if the
69    case of thematic data, return the data as factors}
70  \item{list_out}{default FALSE, return array, if TRUE, return a list of vector bands}
71  \item{raster}{An object of class GDALRasterBand}
72  \item{x}{integer variable for conversion}
73  \item{base}{If Byte input, 8, if Int16 or UInt16, 16}
74  \item{OVERRIDE_PROJ_DATUM_WITH_TOWGS84}{logical value, default NULL, which case the cached option set by \code{set_OVERRIDE_PROJ_DATUM_WITH_TOWGS84} is used. Ignored if the GDAL version is less than \dQuote{1.8.0} or if the CPLConfigOption variable is already set}
75  \item{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.}
76  \item{value}{logical value to set OVERRIDE_PROJ_DATUM_WITH_TOWGS84}
77}
78
79\details{
80  \describe{
81    \item{\code{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.}
82
83    \item{\code{getRasterTable}:}{retrieves data from the dataset as data frame.}
84
85    \item{\code{getProjectionRef}:}{returns the geodetic projection in
86      Well Known Text format.}
87
88    \item{\code{getRasterBand}:}{returns a raster band}
89
90    \item{\code{getRasterBlockSize}:}{returns the natural block size of
91      the raster band. Use this for efficient tiled IO.}
92
93    \item{\code{toSigned}:}{used to convert a band read as unsigned integer to signed integer}
94    \item{\code{toUnSigned}:}{used to convert a band read as signed integer to unsigned integer}
95
96  }
97}
98
99\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 \url{https://trac.osgeo.org/gdal/ticket/4880} and \url{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 \code{open.SpatialGDAL}, \code{sub.GDROD}, and \code{asGDALROD_SGDF}, which do not have a suitable argument}
100
101
102\author{Timothy H. Keitt, modified by Roger Bivand}
103
104\seealso{See also \code{\link{GDALDriver-class}}, \code{\link{GDALDataset-class}}, \code{\link{GDALTransientDataset-class}}}
105
106\examples{
107logo <- system.file("pictures/logo.jpg", package="rgdal")[1]
108x <- new("GDALReadOnlyDataset", logo)
109plot(density(getRasterTable(x)$band1))
110GDAL.close(x)
111}
112\keyword{classes}
113