EVOLUTION-MANAGER
Edit File: SpatialGrid.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: define spatial grid</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 SpatialPixels {sp}"><tr><td>SpatialPixels {sp}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2> define spatial grid </h2> <h3>Description</h3> <p>defines spatial grid by offset, cell size and dimensions </p> <h3>Usage</h3> <pre> GridTopology(cellcentre.offset, cellsize, cells.dim) SpatialPixels(points, tolerance = sqrt(.Machine$double.eps), proj4string = CRS(as.character(NA)), round = NULL, grid = NULL) SpatialGrid(grid, proj4string = CRS(as.character(NA))) coordinatevalues(obj) points2grid(points, tolerance = sqrt(.Machine$double.eps), round=NULL) getGridIndex(cc, grid, all.inside = TRUE) getGridTopology(obj) areaSpatialGrid(obj) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>cellcentre.offset</code></td> <td> <p>numeric; vector with the smallest centroid coordinates for each dimension; coordinates refer to the cell centre</p> </td></tr> <tr valign="top"><td><code>cellsize</code></td> <td> <p>numeric; vector with the cell size in each dimension</p> </td></tr> <tr valign="top"><td><code>cells.dim</code></td> <td> <p>integer; vector with number of cells in each dimension</p> </td></tr> <tr valign="top"><td><code>points</code></td> <td> <p> coordinates, object of class <a href="SpatialPoints-class.html">SpatialPoints-class</a> </p> </td></tr> <tr valign="top"><td><code>grid</code></td> <td> <p> grid topology; object of class <a href="GridTopology-class.html">GridTopology-class</a>; for calls to <code>SpatialPixels</code>, a value of NULL implies that this will be derived from the point coordinates </p> </td></tr> <tr valign="top"><td><code>tolerance</code></td> <td> <p> precision, used to which extent points are exactly on a grid</p> </td></tr> <tr valign="top"><td><code>round</code></td> <td> <p>default NULL, otherwise a value passed to as the digits argument to <code>round</code> for setting cell size</p> </td></tr> <tr valign="top"><td><code>proj4string</code></td> <td> <p> object of class <a href="CRS-class.html">CRS-class</a></p> </td></tr> <tr valign="top"><td><code>obj</code></td> <td> <p>object of class or deriving from <a href="SpatialGrid-class.html">SpatialGrid-class</a></p> </td></tr> <tr valign="top"><td><code>cc</code></td> <td> <p> numeric matrix with coordinates </p> </td></tr> <tr valign="top"><td><code>all.inside</code></td> <td> <p> logical; if TRUE and <code>cc</code> points fall outside the grid area, an error message is generated; if FALSE, NA values are generated for such points </p> </td></tr> </table> <h3>Value</h3> <p> GridTopology returns a value of class <a href="GridTopology-class.html">GridTopology-class</a>; SpatialGrid returns an object of class <a href="SpatialGrid-class.html">SpatialGrid-class</a> </p> <p><code>coordinatevalues</code> returns a list with the unique x-coordinates, the unique y-coordinate, etc. instead of the <a href="coordinates.html">coordinates</a> of all grid cells </p> <p>SpatialGrid returns an object of class <a href="SpatialGrid-class.html">SpatialGrid-class</a>. </p> <p>points2grid returns the <a href="GridTopology-class.html">GridTopology-class</a> from a set of points. </p> <p>getGridIndex finds the index of a set of point coordinates in a given grid topology, and depending on <code>all.inside</code> setting, generates NA or an error message if points are outside the grid domain. </p> <p>getGridTopology returns the slot of class <a href="GridTopology-class.html">GridTopology-class</a> from obj. </p> <p>areaSpatialGrid returns the spatial area of (the non-missing valued cells of) the grid. For objects of class <a href="SpatialGridDataFrame-class.html">SpatialGridDataFrame-class</a> the area refers to cells where any (one or more) of the attribute columns are non-missing valued. </p> <h3>Note</h3> <p>SpatialGrid stores grid topology and may or may not store the coordinates of the actual points, which may form a subset of the full grid. To find out or change this, see <a href="gridded-methods.html">fullgrid</a>. </p> <p>points2grid tries to figure out the grid topology from points. It succeeds only if points on a grid line have constant y column, and points on a grid column have constant x coordinate, etc. In other cases, use signif on the raw coordinate matrices to make sure this is the case. </p> <h3>Author(s)</h3> <p> Edzer Pebesma, <a href="mailto:edzer.pebesma@uni-muenster.de">edzer.pebesma@uni-muenster.de</a></p> <h3>See Also</h3> <p><a href="SpatialGrid-class.html">SpatialGrid-class</a>, <a href="SpatialGridDataFrame-class.html">SpatialGridDataFrame-class</a>, </p> <h3>Examples</h3> <pre> x = GridTopology(c(0,0), c(1,1), c(5,4)) class(x) x summary(x) coordinates(x) coordinates(GridTopology(c(0,0), c(1,1), c(5,4))) coordinatevalues(x) data(meuse.grid) coordinates(meuse.grid) <- c("x", "y") points2grid(meuse.grid) data(meuse.grid) set.seed(1) meuse.grid$x <- meuse.grid$x + rnorm(length(meuse.grid$x), 0, 0.002) meuse.grid$y <- meuse.grid$y + rnorm(length(meuse.grid$y), 0, 0.002) coordinates(meuse.grid) <- c("x", "y") #EJP # points2grid(meuse.grid, tolerance=0.76, round=1) data(meuse.grid) a <- which(meuse.grid$x == 180140) b <- which(meuse.grid$x == 180180) c <- which(meuse.grid$x == 179260) d <- which(meuse.grid$y == 332460) e <- which(meuse.grid$y == 332420) f <- which(meuse.grid$y == 330740) meuse.grid <- meuse.grid[-c(a, b, c, d, e, f),] coordinates(meuse.grid) <- c("x", "y") points2grid(meuse.grid) data(meuse.grid) set.seed(1) meuse.grid$x <- meuse.grid$x + rnorm(length(meuse.grid$x), 0, 0.002) meuse.grid$y <- meuse.grid$y + rnorm(length(meuse.grid$y), 0, 0.002) meuse.grid <- meuse.grid[-c(a, b, c, d, e, f),] coordinates(meuse.grid) <- c("x", "y") # EJP # points2grid(meuse.grid, tolerance=0.69, round=1) </pre> <hr /><div style="text-align: center;">[Package <em>sp</em> version 1.4-2 <a href="00Index.html">Index</a>]</div> </body></html>