# slopeasp

##### Calculate slope and aspect from elevation data.

Uses gridded elevation data to calculate slope and aspect, by default using a 3x3 region. The horizontal resolution and vertical resolution must be in the same units.

- Keywords
- spatial

##### Usage

`slopeasp(x, EWres, NSres, EWkernel, NSkernel, smoothing=1)`

##### Arguments

- x
gridded elevation data, either as a SpatialGridDataFrame, dataframe, or matrix.

- EWres
East-West grid resolution. May be omitted if x is a SpatialGridDataFrame and the horizontal units are the same as the vertical units.

- NSres
North-South grid resolution. May be omitted if x is a SpatialGridDataFrame and the horizontal units are the same as the vertical units.

- EWkernel
The kernel to use when calculating the East-West component of slope. If missing, a 3x3 kernel will be used.

- NSkernel
The kernel to use when calculating the North-South component of slope. If missing, a 3x3 kernel will be used.

- smoothing
A positive integer describing the additional smoothing to be applied, if any. smoothing=1 (default) means no smoothing will be used.

##### Details

By default, a 3x3 Sobel filter is used (as is standard in many GIS packages). A larger Sobel filter or a different filter will give varying results. This filter provides the third-order finite difference weighted by reciprocal of distance method proposed by Unwin (1981).

##### Value

The slope of the DEM, in degrees

The aspect of the DEM, beginning with north and moving clockwise, and with aspect = 0 where slope = 0.

##### References

Unwin, D. 1981. Introductory Spatial Analysis. London: Methuen. Clarke, K.C.and Lee, S.J. 2007. Spatial resolution and algorithm choice as modifiers of downslope flow computed from Digital Elevation Models. Cartography and Geographic Information Science 34:215-230.

##### See Also

##### Examples

```
# NOT RUN {
data(dem)
dem.slopeasp <- slopeasp(dem)
par(mfrow=c(1,3))
image(dem)
image(dem.slopeasp$slope)
image(dem.slopeasp$aspect)
# }
```

*Documentation reproduced from package landsat, version 1.1.0, License: GPL (>= 2)*