GRASS logo


v.habitat.dem - Calculates DEM derived characteristics of habitats.


vector, raster, terrain, statistics, sun, zonal statistics


v.habitat.dem --help
v.habitat.dem elevation=name vector=name column=name prefix=prefix dir=name [region_extension=float] [start_time=float] [end_time=float] [time_step=float] [day=integer] [year=integer] [--help] [--verbose] [--quiet] [--ui]


Print usage summary
Verbose module output
Quiet module output
Force launching GUI dialog


elevation=name [required]
Name of elevation raster map
vector=name [required]
Name of input vector map
Name of habitat vector map
column=name [required]
Name of attribute column with a unique habitat ID (must be numeric)
prefix=prefix [required]
output prefix (must start with a letter)
dir=name [required]
Directory where the output will be found
region extension
Default: 5000
Start time of interval
Use up to 2 decimal places
Options: 0-24
Default: 8
End time of interval
Use up to 2 decimal places
Options: 0-24
Default: 18
Time step for running r.sun [decimal hours]
Use up to 2 decimal places
Options: 0-24
Default: 1
No. of day of the year
Options: 1-365
Default: 172
Year used for map registration into temporal dataset or r.timestamp
This value is not used in r.sun calculations
Options: 1900-9999
Default: 2014

Table of contents


v.habitat.dem calculates DEM and solar derived characteristics of habitat vector polygons. The user must specify the input elevation raster map, a habitat vector map with a numeric unique ID column and a prefix used for all results.

A preliminary visual delineation of habitats based upon digital orthophotos is a common task for an ecologist before fieldwork. Ecological site conditions of habitats are often influenced amongst others by terrain forms, solar irradiance and irradiation. v.habitat.dem gives some DEM derived characteristics for a quick validation of the preliminary visual habitat delineation.


The location has to be in a projected coordination system. Before running v.habitat.dem the region has to be aligned to the elevation raster map and the habitat vector map by g.region. During calculations, especially for solar characteristics, the region will be extended by a user input (default 5.000). The results are as good as the DEM quality and resolution is.

Terrain characteristics

Slope and aspect are calculated by r.slope.aspect.

The slope output raster map contains slope values, stated in degrees of inclination from the horizontal.
The aspect output raster map indicates the direction that slopes are facing. The aspect categories represent the number degrees of east.

Accumulation, drainage direction and topographic index are calculated by r.watershed. The flag -a (use positive flow accumulation even for likely underestimates) is used as default.

The accumulation map contains the absolute value of each cell in this output map and is the amount of overland flow that traverses the cell. This value will be the number of upland cells plus one if no overland flow map is given.
The drainage direction map contains drainage direction. Provides the "aspect" for each cell measured CCW from East.
The topographic index raster map contains topographic index TCI and is computed as ln(α / tan(β)) where α a is the cumulativeupslope area draining through a point per unit contour length and tan(β) is the local slope angle. The TCI reflects the tendency of water to accumulate at any point in the catchment and the tendency for gravitaional forces to move that water downslope. This value will be negative if α / tan(β) < 1.

Terrain forms are calculated by r.geomorphon.

Geomorphon is a new concept of presentation and analysis of terrain forms using machine vision approach. This concept utilises 8-tuple pattern of the visibility neighbourhood and breaks well known limitation of standard calculus approach where all terrain forms cannot be detected in a single window size. The pattern arises from a comparison of a focus pixel with its eight neighbours starting from the one located to the east and continuing counterclockwise producing a ternary operator. All options in the r.geomorphon-calculation are set to default (skip = 0, search = 3, flat = 1, dist = 0) where search determines the length on the geodesic distances in all eight directions where line-of-sight is calculated, skip determines length on the geodesic distances at the beginning of calculation all eight directions where line-of-sight is yet calculated, flat defines the difference (in degrees) between zenith and nadir line-of-sight which indicate flat direction and dist determines > flat distance.

The most common terrain forms calculated by r.geomorphon are:

The LS factor

The LS is the slope length-gradient factor. The LS factor represents a ratio of soil loss under given conditions to that at a site with the "standard" slope steepness of 9% and slope length of 22.13m. The steeper and longer the slope, the higher the risk for erosion.

The LS factor is calculated accordingly Neteler & Mitasova 2008 in r.mapcalc with flow accumulation of r.flow and slope of r.slope.aspect

  1.4 * exp(flow_accumulation * resolution / 22.1, 0.4) * exp(sin(slope) 0.09, 1.2)

The colors of the LS factor map are set to:

Terrain characteristics uploaded to the habitat vector attribute table per polygon

Additionally the mutual occurrence by r.coin of unique habitat ID and geomorphons in percent of the row is printed to the output.

Simple check of terrain characteristics

Simple checks regarding aspect and slope per unique habitat ID are evaluated and marked in the attribute table as follow:

These simple checks may indicate reconsidering of some preliminary visual habitat delineations.

Solar characteristics

The solar characterstics (direct sunlight / shadows caused by terrain for a certain day in the year) are calculated by r.sun.hourly based upon r.sun. The -b-flag is used to create binary rasters instead of irradiation rasters. The user can define start time of interval, end time of interval, time step for running r.sun, number of day of the year and the year. As default is set summer solstice (21st June 2014, 8:00-18:00, 1 hour time step).

The results of the r.sun.hourly-analysis are automatically registered into a temporal database. The space time raster dataset can be easily animated in the g.gui.animation-tool.


  # align region to DEM and habitat vector
  g.region -a raster=DEM vect=myhabitats align=DEM

  # run v.habitat.dem
  v.habitat.dem elevation=DEM vector=myhabitats column=Id prefix=a dir=C:\wd

  # do r.null to the r.sun.hourly output to get maps without direct beam
  r.null map=a_beam_rad_08.00 setnull=1
  r.null map=a_beam_rad_18.00 setnull=1

  # animate the r.sun.hourly output by the g.gui.animation-tool
  g.gui.animation strds=a_beam_rad



g.gui.animation g.region, r.coin, r.geomorphon, r.mapcalc, r.slope.aspect, r.sun, r.sun.hourly, r.stats, r.watershed, v.rast.stats,


Neteler, M. & Mitasova, H. 2008. Open Source GIS. A GRASS GIS Approach. Third Edition. Springer.


Helmut Kudrnovsky

Last changed: $Date: 2014-12-27 14:30:46 +0100 (Sat, 27 Dec 2014) $


Available at: v.habitat.dem source code (history)

Main index | Vector index | Topics index | Keywords index | Graphical index | Full index

© 2003-2017 GRASS Development Team, GRASS GIS 7.2.3svn Reference Manual