EVOLUTION-MANAGER
Edit File: Raster-classes.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Raster* classes</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for Raster-class {raster}"><tr><td>Raster-class {raster}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> Raster* classes</h2> <h3>Description</h3> <p>A raster is a database organized as a rectangular grid that is sub-divided into rectangular cells of equal area (in terms of the units of the coordinate reference system). The 'raster' package defines a number of "S4 classes" to manipulate such data. </p> <p>The main user level classes are <code>RasterLayer</code>, <code>RasterStack</code> and <code>RasterBrick</code>. They all inherit from <code>BasicRaster</code> and can contain values for the raster cells. </p> <p>An object of the <code>RasterLayer</code> class refers to a single layer (variable) of raster data. The object can point to a file on disk that holds the values of the raster cells, or hold these values in memory. Or it can not have any associated values at all. </p> <p>A <code>RasterStack</code> represents a collection of <code>RasterLayer</code> objects with the same extent and resolution. Organizing <code>RasterLayer</code> objects in a <code>RasterStack</code> can be practical when dealing with multiple layers; for example to summarize their values (see <code><a href="calc.html">calc</a></code>) or in spatial modeling (see <code><a href="predict.html">predict</a></code>). </p> <p>An object of class <code>RasterBrick</code> can also contain multiple layers of raster data, but they are more tightly related. An object of class <code>RasterBrick</code> can refer to only a single (multi-layer) data file, whereas each layer in a <code>RasterStack</code> can refer to another file (or another band in a multi-band file). This has implications for processing speed and flexibility. A <code>RasterBrick</code> should process quicker than a <code>RasterStack</code> (irrespective if values are on disk or in memory). However, a <code>RasterStack</code> is more flexible as a single object can refer to layers that have values stored on disk as well as in memory. If a layer that does not refer to values on disk (they only exists in memory) is added to a <code>RasterBrick</code>, it needs to load all its values into memory (and this may not be possible because of memory size limitations). </p> <p>Objects can be created from file or from each other with the following functions: <code><a href="raster.html">raster</a>, <a href="brick.html">brick</a></code> and <a href="stack.html">stack</a>. </p> <p><code>Raster*</code> objects can also be created from SpatialPixels* and SpatialGrid* objects from the sp package using <code>as</code>, or simply with the function <code><a href="raster.html">raster</a></code>, <code><a href="brick.html">brick</a></code>, or <code><a href="stack.html">stack</a></code>. Vice versa, <code>Raster*</code> objects can be coerced into a sp type object with <code>as( , )</code>, e.g. <code>as(x, 'SpatialGridDataFrame')</code> . </p> <p>Common generic methods implemented for these classes include: </p> <p><code>summary</code>, <code>show</code>, <code>dim</code>, and <code>plot, ...</code> </p> <p><code>[</code> is implemented for RasterLayer. </p> <p>The classes described above inherit from the <code>BasicRaster</code> class which inherits from <code>BasicRaster</code>. The <code>BasicRaster</code> class describes the main properties of a raster such as the number of columns and rows, and it contains an object of the <code>link[raster]{Extent-class}</code> to describe its spatial extent (coordinates). It also holds the 'coordinate reference system' in a slot of class <code><a href="../../sp/html/CRS-class.html">CRS-class</a></code> defined in the <code>sp</code> package. A <code>BasicRaster</code> cannot contain any raster cell values and is therefore seldomly used. </p> <p>The <code>Raster*</code> class inherits from <code>BasicRaster</code>. It is a virtual class; which means that you cannot create an object of this class. It is used only to define methods for all the classes that inherit from it (<code>RasterLayer</code>, <code>RasterStack</code> and <code>RasterBrick</code>). Another virtual class is the <code>RasterStackBrick</code> class. It is formed by a class union of <code>RasterStack</code> and <code>RasterBrick</code>. You cannot make objects of it, but methods defined for objects of this class as arguments will accept objects of the <code>RasterLayer</code> and <code>RasterStack</code> as that argument. </p> <p>Classes <code>RasterLayer</code> and <code>RasterBrick</code> have a slot with an object of class <code>RasterFile</code> that describes the properties of the file they point to (if they do). <code>RasterLayer</code> has a slot with an object of class <code>SingleLayerData</code>, and the <code>RasterBrick</code> class has a slot with an object of class <code>MultipleLayerData</code>. These 'datalayer' classes can contain (some of) the values of the raster cells. </p> <p>These classes are not further described here because users should not need to directly access these slots. The 'setter' functions such as <code>setValues</code> should be used instead. Using such 'setter' functions is much safer because a change in one slot should often affect the values in other slots. </p> <h3>Objects from the Class</h3> <p>Objects can be created by calls of the form <code>new("RasterLayer", ...)</code>, or with the helper functions such as <code>raster</code>. </p> <h3>Slots</h3> <p>Slots for RasterLayer and RasterBrick objects </p> <dl> <dt><code>title</code>:</dt><dd><p>Character</p> </dd> <dt><code>file</code>:</dt><dd><p>Object of class <code>".RasterFile"</code> </p> </dd> <dt><code>data</code>:</dt><dd><p>Object of class <code>".SingleLayerData"</code> or <code>".MultipleLayerData"</code></p> </dd> <dt><code>history</code>:</dt><dd><p>To record processing history, not yet in use </p> </dd> <dt><code>legend</code>:</dt><dd><p>Object of class <code>.RasterLegend</code>, Default legend. Should store preferences for plotting. Not yet implemented except that it stores the color table of images, if available</p> </dd> <dt><code>extent</code>:</dt><dd><p>Object of <code><a href="Extent-class.html">Extent-class</a></code> </p> </dd> <dt><code>ncols</code>:</dt><dd><p>Integer</p> </dd> <dt><code>nrows</code>:</dt><dd><p>Integer</p> </dd> <dt><code>crs</code>:</dt><dd><p>Object of class <code>"CRS"</code>, i.e. the coordinate reference system. In Spatial* objects this slot is called 'proj4string' </p> </dd> </dl> <h3>Examples</h3> <pre> showClass("RasterLayer") </pre> <hr /><div style="text-align: center;">[Package <em>raster</em> version 3.3-13 <a href="00Index.html">Index</a>]</div> </body></html>