GRASS logo

Note: A new GRASS GIS stable version has been released: GRASS GIS 7. Go directly to the new manual page here


r.walk - Creates a raster map showing the anisotropic cumulative cost of moving between different geographic locations on an input raster map whose cell category values represent cost.


raster, cost surface, cumulative costs


r.walk help
r.walk [-knr] elevation=string friction=string output=string [outdir=string] [start_points=string] [stop_points=string] [coordinate=x,y[,x,y,...]] [stop_coordinate=x,y[,x,y,...]] [max_cost=integer] [null_cost=float] [percent_memory=integer] [nseg=integer] [walk_coeff=a,b,c,d] [lambda=float] [slope_factor=float] [--overwrite] [--verbose] [--quiet]


Use the 'Knight's move'; slower, but more accurate
Keep null values in output map
Start with values in raster map
Allow output files to overwrite existing files
Verbose module output
Quiet module output


Name of elevation input raster map
Name of input raster map containing friction costs
Name of raster map to contain results
Name of output raster map to contain movement directions
Starting points vector map
Stop points vector map
The map E and N grid coordinates of a starting point (E,N)
The map E and N grid coordinates of a stopping point (E,N)
An optional maximum cumulative cost
Default: 0
Cost assigned to null cells. By default, null cells are excluded
Percent of map to keep in memory
Default: 100
Number of the segment to create (segment library)
Default: 4
Coefficients for walking energy formula parameters a,b,c,d
Default: 0.72,6.0,1.9998,-1.9998
Lambda coefficients for combining walking energy and friction cost
Default: 1.0
Slope factor determines travel energy cost per height step
Default: -0.2125


r.walk computes anisotropic cumulative cost of moving between different geographic locations on an input elevation raster map whose cell category values represent elevation combined with an input raster map layer whose cell values represent friction cost.

r.walk outputs 1) a raster map showing the lowest cumulative cost (time) of moving between each cell and the user-specified starting points and 2) a second raster map showing the movement direction to the next cell on the path back to the start point (see Movement Direction). It uses an input elevation raster map whose cell category values represent elevation, combined with a second input raster map whose cell values represent friction costs.

This function is similar to r.cost, but in addiction to a friction map, it considers an anisotropic travel time due to the different walking speed associated with downhill and uphill movements.


The formula from Aitken 1977/Langmuir 1984 (based on Naismith's rule for walking times) has been used to estimate the cost parameters of specific slope intervals:

T = a*delta_S + b*delta_H_uphill + c*delta_H_moderate_downhill + d*delta_H_steep_downhill

The a, b, c, d walk_coeff parameters take in account movement speed in the different conditions and are linked to:

It has been proved that moving downhill is favourable up to a specific slope value threshold, after that it becomes unfavourable. The default slope value threshold (slope_factor) is -0.2125, corresponding to tan(-12), calibrated on human behaviour (>5 and <12 degrees: moderate downhill; >12 degrees: steep downhill). The default values for a, b, c, d walk_coeff parameters are those proposed by Langmuir (0.72, 6.0, 1.9998, -1.9998), based on man walking effort in standard conditions.

The friction cost parameter represents a time penalty in seconds of additional walking time to cross 1 meter distance.

The lambda parameter is a dimensionless scaling factor of the friction cost:

total cost = movement time cost + lambda * friction costs * delta_S

For a more accurate result, the "knight's move" option can be used (although it is more time consuming). In the diagram below, the center location (O) represents a grid cell from which cumulative distances are calculated. Those neighbours marked with an x are always considered for cumulative cost updates. With the "knight's move" option, the neighbours marked with a K are also considered.

  K   K 
K x x x K
  x O x
K x x x K
  K   K

The minimum cumulative costs are computed using Dijkstra's algorithm, that find an optimum solution (for more details see r.cost, that uses the same algorithm).

Movement Direction

The movement direction surface is created to record the sequence of movements that created the cost accumulation surface. Without it r.drain would not correctly create a path from an end point back to the start point. The direction shown in each cell points away from the cell that came before it. The directions are recorded as degrees CCW from East:

       112.5 90  67.5         i.e. a cell with the value 135 
157.5  135   0   45   22.5    means the cell before it is 
       180   x   0            to the south-east.
202.5  225  270  315  337.5
       247.5     292.5

Once r.walk computes the cumulative cost map as a linear combination of friction cost (from friction map) and the altitude and distance covered (from the digital elevation model), r.drain can be used to find the minimum cost path. Make sure to use the -d flag and the movement direction raster map when running r.drain to ensure the path is computed according to the proper movement directions.


We compute a map showing how far a lost person could get from the point where he or she was last seen while taking into account the topography and landcover.
g.region swwake_30m -p

# create friction map based on land cover
r.recode landclass96 out=friction << EOF

r.walk -k elevation=elev_ned_30m friction=friction output=walkcost \
    coordinate=635576,216485 lambda=0.5 max=10000

# compute contours on the cost surface to better understand
# how far the person can get in certain time (1000 is in seconds)
r.contour walkcost output=walkcost step=1000



r.cost, r.drain,, r.mapcalc, r.out.ascii


Based on r.cost written by :

Antony Awaida,
Intelligent Engineering
Systems Laboratory,

James Westervelt,
U.S.Army Construction Engineering Research Laboratory

Updated for Grass 5
Pierre de Mouveaux (

Initial version of r.walk:

Steno Fontanari, 2002

Current version of r.walk:

Franceschetti Simone, Sorrentino Diego, Mussi Fabiano and Pasolli Mattia
Correction by: Fontanari Steno, Napolitano Maurizio and Flor Roberto
In collaboration with: Franchi Matteo, Vaglia Beatrice, Bartucca Luisa, Fava Valentina and Tolotti Mathias, 2004

Updated for GRASS 6.1

Roberto Flor and Markus Neteler

Last changed: $Date: 2015-06-07 14:32:30 -0700 (Sun, 07 Jun 2015) $

Main index - raster index - Full index

© 2003-2016 GRASS Development Team