EVOLUTION-MANAGER
Edit File: xyFromCell.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: Coordinates from a row, column or cell number</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 xyFromCell {raster}"><tr><td>xyFromCell {raster}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Coordinates from a row, column or cell number</h2> <h3>Description</h3> <p>These functions get coordinates of the center of raster cells for a row, column, or cell number of a Raster* object. </p> <h3>Usage</h3> <pre> ## S4 method for signature 'Raster,numeric' xFromCol(object, col) ## S4 method for signature 'Raster,numeric' yFromRow(object, row) ## S4 method for signature 'Raster,numeric' xFromCell(object, cell) ## S4 method for signature 'Raster,numeric' yFromCell(object, cell) ## S4 method for signature 'BasicRaster,ANY' xyFromCell(object, cell, spatial=FALSE, ...) ## S4 method for signature 'Raster' coordinates(obj, ...) ## S4 method for signature 'Extent' coordinates(obj, ...) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>object</code></td> <td> <p>Raster* object (or a SpatialPixels* or SpatialGrid* object)</p> </td></tr> <tr valign="top"><td><code>col</code></td> <td> <p>column number; or vector of column numbers. If missing, the x coordinates for all columns are returned</p> </td></tr> <tr valign="top"><td><code>row</code></td> <td> <p>row number; or vector of row numbers. If missing, the y coordinates for all rows are returned</p> </td></tr> <tr valign="top"><td><code>cell</code></td> <td> <p>cell number(s)</p> </td></tr> <tr valign="top"><td><code>spatial</code></td> <td> <p>If <code>spatial=TRUE</code>, <code>xyFromCell</code> returns a SpatialPoints object instead of a matrix</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>additional arguments. None implemented</p> </td></tr> <tr valign="top"><td><code>obj</code></td> <td> <p>Raster object</p> </td></tr> </table> <h3>Details</h3> <p>Cell numbers start at 1 in the upper left corner, and increase from left to right, and then from top to bottom. The last cell number equals the number of cells of the Raster* object. </p> <h3>Value</h3> <p>xFromCol, yFromCol, xFromCell, yFromCell: vector of x or y coordinates </p> <p>xyFromCell: matrix(x,y) with coordinate pairs </p> <p>coordinates: xy coordinates for all cells </p> <h3>See Also</h3> <p><code><a href="cellFrom.html">cellFromXY</a></code> </p> <h3>Examples</h3> <pre> #using a new default raster (1 degree global) r <- raster() xFromCol(r, c(1, 120, 180)) yFromRow(r, 90) xyFromCell(r, 10000) xyFromCell(r, c(0, 1, 32581, ncell(r), ncell(r)+1)) #using a file from disk r <- raster(system.file("external/test.grd", package="raster")) r cellFromXY(r, c(180000, 330000)) #xy for corners of a raster: xyFromCell(r, c(1, ncol(r), ncell(r)-ncol(r)+1, ncell(r))) </pre> <hr /><div style="text-align: center;">[Package <em>raster</em> version 3.3-13 <a href="00Index.html">Index</a>]</div> </body></html>