surfaceArea

0th

Percentile

Compute surface area of a digital elevation model.

It is often said that if Wales was flattened out it would have an area bigger than England. This function computes the surface area of a grid of heights taking into account the sloping nature of the surface.

Keywords
spatial
Usage
surfaceArea(m, ...)
surfaceArea.matrix(m, cellx = 1, celly = 1, byCell = FALSE)
Arguments
m

a matrix of height values, or an object of class SpatialPixelsDataFrame or SpatialGridDataFrame.

cellx

the size of the grid cells in the x-direction, in the same units as the height values.

celly

the size of the grid cells in the y-direction, in the same units as the height values.

byCell

return single value or matrix of values

...

ignored

Value

Either a single value of the total area if byCell=FALSE, or a matrix the same shape as m of individual cell surface areas if byCell=TRUE. In this case, the sum of the returned matrix should be the same value as that which is returned if byCell=FALSE.

Missing values (NA) in the input matrix are allowed. They will produce an NA in the output matrix for byCell=TRUE, and contribute zero to the total area. They also have an effect on adjacent cells - see code comments for details.

Methods

obj = "matrix"

takes a matrix as input, requires cellx and celly to be set

obj = "SpatialGridDataFrame"

takes an object of class SpatialGridDataFrame as input, and retrieves cellx and celly from this

obj = "SpatialPixelsDataFrame"

takes an object of class SpatialPixelsDataFrame as input, and retrieves cellx and celly from this

References

Calculating Landscape Surface Area from Digital Elevation Models, Jeff S. Jenness Wildlife Society Bulletin, Vol. 32, No. 3 (Autumn, 2004), pp. 829-839

Aliases
  • surfaceArea
  • surfaceArea.matrix
  • surfaceArea,SpatialPixelsDataFrame-method
  • surfaceArea,SpatialGridDataFrame-method
  • surfaceArea,matrix-method
Examples
# NOT RUN {
surfaceArea(volcano)
image(surfaceArea(volcano,byCell=TRUE))

data(meuse.grid)
gridded(meuse.grid) = ~x+y
image(surfaceArea(meuse.grid["dist"], byCell=TRUE))
surfaceArea(meuse.grid["dist"])
# }
Documentation reproduced from package sp, version 1.3-1, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.