8.5 Surface Toolset
8.5.1 Slope and Aspect
In mathematics, the slope or gradient of a line describes its steepness, incline, or grade. A higher slope value indicates a steeper incl.
Source: “http://wiki.gis.com/wiki/index.php/Slope”
In GIS and specifically in terrain analysis, calculating the terrain slope is of great importance, since it can play a significant role in various forms of technical analysis. The most common way of calculating the slope is from a Digital Elevation Model (DEM).
In ArcGIS pro the tool used for computing the slope of a raster dataset with elevation
data is called Slope (3D Analyst)
.It identifies the steepness at each cell of a raster surface.
The lower the slope value, the flatter the terrain; the higher the slope value, the steeper the terrain.
In R
, raster
package includes the function terrain()
, which helps us compute
slope, aspect and other terrain characteristics from a raster with elevation data.
Let’s start by computing the slope of the swissAlti3d raster dataset.
data("swissAlti3D")
plot(swissAlti3D)

Figure 8.2: swissALTI3D2019 - CRS: CH1903+LV95
After importing and visualizing our raster dataset, we use the terrain
function
to calculate the slope.
# Computing the slope of a raster dataset using the terrain() function
<- terrain(swissAlti3D, opt = "slope", unit = "degrees")
swissAlti3d_slope plot(swissAlti3d_slope)

Figure 8.3: swissALTI3D2019 - CRS: CH1903+LV95
In the function above, we define the operation we want to perform as the second
argument of the function (opt = “slope”). Furthermore, we also define the units
of the final result.
Similarly, we compute the aspect
of a given dataset. Basically as aspect
we can
consider the compass direction that a slope
leans towards.
Let’s compute now, using again the same function terrain
, the aspect
of the
same dataset swissALTI3D2019.
# Computing the aspect of the terrain dataset
<- terrain(swissAlti3D, opt = "aspect", unit = "degrees")
swissAlti3d_aspect plot(swissAlti3d_aspect)

Figure 8.4: Aspect of swissALTI3D2019 in degrees (°)
So, R gives us the option to retrieve multiple terrain characteristics of a raster
dataset, using only one function. The aforementioned spatial operation in ArcGIS pro
could be performed using the tool Aspect (Spatial Analyst)
.