| 1 |
\name{surfaceArea} |
| 2 |
\alias{surfaceArea} |
| 3 |
\alias{surfaceArea.matrix} |
| 4 |
\alias{surfaceArea,SpatialPixelsDataFrame-method} |
| 5 |
\alias{surfaceArea,SpatialGridDataFrame-method} |
| 6 |
\alias{surfaceArea,matrix-method} |
| 7 |
|
| 8 |
\title{ |
| 9 |
Compute surface area of a digital elevation model. |
| 10 |
} |
| 11 |
\description{ |
| 12 |
It is often said that if Wales was flattened out it would have |
| 13 |
an area bigger than England. This function computes the surface |
| 14 |
area of a grid of heights taking into account the sloping nature |
| 15 |
of the surface. |
| 16 |
} |
| 17 |
\usage{ |
| 18 |
surfaceArea(m, ...) |
| 19 |
surfaceArea.matrix(m, cellx = 1, celly = 1, byCell = FALSE) |
| 20 |
} |
| 21 |
\arguments{ |
| 22 |
\item{m}{ |
| 23 |
a matrix of height values, or an object of class \link{SpatialPixelsDataFrame} or \link{SpatialGridDataFrame}. |
| 24 |
} |
| 25 |
\item{cellx}{ |
| 26 |
the size of the grid cells in the x-direction, in the same units as the height values. |
| 27 |
} |
| 28 |
\item{celly}{ |
| 29 |
the size of the grid cells in the y-direction, in the same units as |
| 30 |
the height values. |
| 31 |
} |
| 32 |
\item{byCell}{ |
| 33 |
return single value or matrix of values |
| 34 |
} |
| 35 |
\item{...}{ignored} |
| 36 |
} |
| 37 |
|
| 38 |
\value{ |
| 39 |
Either a single value of the total area if byCell=FALSE, or a matrix |
| 40 |
the same shape as m of individual cell surface areas if |
| 41 |
byCell=TRUE. In this case, the sum of the returned matrix should be |
| 42 |
the same value as that which is returned if byCell=FALSE. |
| 43 |
|
| 44 |
Missing values (NA) in the input matrix are allowed. They will produce |
| 45 |
an NA in the output matrix for byCell=TRUE, and contribute zero to the |
| 46 |
total area. They also have an effect on adjacent cells - see code |
| 47 |
comments for details. |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
\section{Methods}{ |
| 52 |
\describe{ |
| 53 |
\item{obj = "matrix"}{ takes a matrix as input, requires cellx and celly to be set } |
| 54 |
\item{obj = "SpatialGridDataFrame"}{ takes an object of class \link{SpatialGridDataFrame} as input, and retrieves cellx and celly from this } |
| 55 |
\item{obj = "SpatialPixelsDataFrame"}{ takes an object of class \link{SpatialPixelsDataFrame} as input, and retrieves cellx and celly from this } |
| 56 |
}} |
| 57 |
|
| 58 |
|
| 59 |
\references{ |
| 60 |
Calculating Landscape Surface Area from Digital Elevation Models, Jeff S. Jenness |
| 61 |
Wildlife Society Bulletin, Vol. 32, No. 3 (Autumn, 2004), pp. 829-839 |
| 62 |
} |
| 63 |
\author{ |
| 64 |
Barry Rowlingson <[email protected]>, integration in sp Edzer |
| 65 |
Pebesma. |
| 66 |
} |
| 67 |
|
| 68 |
\examples{ |
| 69 |
surfaceArea(volcano) |
| 70 |
image(surfaceArea(volcano,byCell=TRUE)) |
| 71 |
|
| 72 |
data(meuse.grid) |
| 73 |
gridded(meuse.grid) = ~x+y |
| 74 |
image(surfaceArea(meuse.grid["dist"], byCell=TRUE)) |
| 75 |
surfaceArea(meuse.grid["dist"]) |
| 76 |
} |
| 77 |
|
| 78 |
\keyword{spatial} |
| 79 |
|