GRASS logo


r.los - Line-of-sight raster analysis program.




r.los help
r.los input=string output=string coordinate=x,y [patt_map=string] [obs_elev=float] [max_dist=float] [--overwrite]


Force overwrite of output files


Raster map containing elevation data
Raster map name for storing results
Coordinate identifying the viewing location
Binary (1/0) raster map to use as a mask
Height above ground of the viewing location
Default: 1.75
Max distance from the viewing point (meters)
Options: 0-99999
Default: 1000


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:
r.los elevation.dem out=los coord=598869,4916642 obs_elev=50 max_dist=10000
r.colors los color=rules << EOF
 0% blue
 75 blue
 80 cyan
 85 yellow
 90 red
 100% red
d.his i=aspect h=los
echo "symbol extra/target 25 598869 4916642 red black" | d.graph -m




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

Last changed: $Date: 2007/10/31 04:06:53 $

Main index - raster index - Full index