In R's raster::terrain function, which way is north?

The `terrain` function in R's `raster` package calculates slope and aspect from an elevation raster: see http://www.inside-r.org/packages/cran/raster/docs/terrain.

With the unit="degrees" option, the function returns aspect values in [0, 360]. Which way is north? Which way is west? I am not an arcgis user, but arcgis documentation says

Aspect identifies the downslope direction of the maximum rate of change in value from each cell to its neighbors. It can be thought of as the slope direction. The values of each cell in the output raster indicate the compass direction that the surface faces at that location. It is measured clockwise in degrees from 0 (due north) to 360 (again due north), coming full circle. Flat areas having no downslope direction are given a value of -1.

Is that standard? Does raster::terrain in R follow the same convention, i.e. do 0 and 360 both mean north?

Snippet of R code:

``````> library(raster)
> swiss_elevation <- getData('alt', country='CHE')
> raster_brick <- terrain(swiss_elevation, opt=c('slope', 'aspect'), unit='degrees')
> raster_brick\$elevation <- swiss_elevation
> plot(raster_brick)
> summary(raster_brick\$aspect[])
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
0.00   88.58  179.60  183.60  283.70  360.00   81354
``````

This little example suggests that 0 is indeed north, 90 is east, et cetera:

``````library(raster)

test <- raster(ncols=100, nrows=100)
test[] <- 1
max_i <- 10
for(i in seq(max_i, 1)) {
test[seq(50-i, 50+i), seq(50-i, 50+i)] <- max_i - i + 1  # "Mountain" at center of raster
}
plot(test)
plot(terrain(test, opt="aspect", unit="degrees"))  # What causes the bands?
plot(terrain(test, opt="slope"))
``````

Does any of the R raster documentation point that out, or is it so obvious that it doesn't need to be stated?

• It's not really north, zero is just "up the page". For some maps you need to correct for north at each pixel Jul 21, 2016 at 16:55
• @mdsumner Would the need for correction depend on the projection? Where is that documented? For a given projection, how can I know whether aspect=0 represents north? Jul 21, 2016 at 16:57