r.los generates a raster output map in which the cells that are visible from a user-specified observer position are marked with the vertical angle (in degrees) required to see those cells (viewshed). A value of 0 is directly below the specified viewing position, 90 is due horizontal, and 180 is directly above the observer. The angle to the cell containing the viewing position is undefined and set to 180.

To run r.los, the user must specify at least an input map name, output map name, and the geographic coordinates of the user's viewing location; any remaining parameters whose values are unspecified will be set to their default values (see below).

The patt_map is the name of a binary (1/0) raster map layer in which cells within the areas of interest are assigned the category value '1', and all other cells are assigned the category value '0' or NULL. If this parameter is omitted, the analysis will be performed for the whole area within a certain distance of the viewing point inside the geographic region boundaries.
Default: assign all cells that are within the max_dist and within the user's current geographic region boundaries a value of 1.

The obs_elev parameter defines the height of the observer (in meters) above the viewing point's elevation.

The max_dist parameter is the maximum distance (in meters) from the viewing point inside of which the line of sight analysis will be performed. The cells outside this distance range are assigned a NULL value.


For accurate results, the program must be run with the resolution of the geographic region set equal to the resolution of the data (see g.region).

The time to complete the calculation increases dramatically with the region size. Try to keep the columns and rows under 1000.

It is advisable to use a 'pattern layer' which identifies the areas of interest in which the line of sight analysis is required. Such a measure will reduce the time taken by the program to run.

The curvature of the Earth is not taken into account for these calculations. However, for interest's sake, a handy calculation for distance to the true horizon is approximated by d = sqrt(13*h) where h is the height of the observer in meters (above sea level) and d is the distance to the horizon in km. This may be useful for setting the max_dist value.


Spearfish example - calculation of viewshed from 50m tower on top of a mountain:
g.region rast=elevation.dem -p
r.los elevation.dem out=los coord=598869,4916642 obs_elev=50 max_dist=10000
r.colors -e los color=bgyr
d.shadedmap relief=aspect drape=los bright=10
echo "symbol extra/target 25 598869 4916642 red" | d.graph -m


a) Rewrite using ideas from r.cva and a method which scales better to large regions.
A suggested method is detailed in:
Izraelevitz, David (USACE).
'A Fast Algorithm for Approximate Viewshed Computation'
Photogrammetric Engineering & Remote Sensing, July 2003 b) or fix r.viewshed in Addons




Kewan Q. Khawaja, Intelligent Engineering Systems Laboratory, M.I.T.

Last changed: $Date$