Skip to content

r.viewshed.cva

Undertakes a "cumulative viewshed analysis" using a vector points map as input "viewing" locations, using r.viewshed to calculate the individual viewsheds.

r.viewshed.cva [-kcrbe] input=name vector=name output=name [observer_elevation=float] [target_elevation=float] [max_distance=float] [memory=integer] [refraction_coeff=float] [name_column=name] [--overwrite] [--verbose] [--quiet] [--qq] [--ui]

Example:

r.viewshed.cva input=name vector=name output=name

grass.script.run_command("r.viewshed.cva", input, vector, output, observer_elevation=1.75, target_elevation=1.75, max_distance=-1, memory=500, refraction_coeff=0.14286, name_column=None, flags=None, overwrite=False, verbose=False, quiet=False, superquiet=False)

Example:

gs.run_command("r.viewshed.cva", input="name", vector="name", output="name")

Parameters

input=name [required]
    Input elevation map (DEM)
vector=name [required]
    Name of input vector map
    Name of input vector points map containg the set of points for this analysis.
output=name [required]
    Output cumulative viewshed raster
observer_elevation=float
    Height of observation points off the ground
    Default: 1.75
target_elevation=float
    Height of target areas off the ground
    Default: 1.75
max_distance=float
    Maximum visibility radius. By default infinity (-1)
    Default: -1
memory=integer
    Amount of memory to use (in MB)
    Default: 500
refraction_coeff=float
    Refraction coefficient (with flag -r)
    Allowed values: 0.0-1.0
    Default: 0.14286
name_column=name
    Database column for point names (with flag -k)
-k
    Keep all interim viewshed maps produced by the routine (maps will be named "vshed_'name'_uniquenumber", where 'name' is the value in "name_column" for each input point. If no value specified in "name_column", cat value will be used instead)
-c
    Consider the curvature of the earth (current ellipsoid)
-r
    Consider the effect of atmospheric refraction
-b
    Output format is {0 (invisible) 1 (visible)}
-e
    Output format is invisible = NULL, else current elev - viewpoint_elev
--overwrite
    Allow output files to overwrite existing files
--help
    Print usage summary
--verbose
    Verbose module output
--quiet
    Quiet module output
--qq
    Very quiet module output
--ui
    Force launching GUI dialog

input : str, required
    Input elevation map (DEM)
    Used as: input, raster, name
vector : str, required
    Name of input vector map
    Name of input vector points map containg the set of points for this analysis.
    Used as: input, vector, name
output : str, required
    Output cumulative viewshed raster
    Used as: output, raster, name
observer_elevation : float, optional
    Height of observation points off the ground
    Default: 1.75
target_elevation : float, optional
    Height of target areas off the ground
    Default: 1.75
max_distance : float, optional
    Maximum visibility radius. By default infinity (-1)
    Default: -1
memory : int, optional
    Amount of memory to use (in MB)
    Default: 500
refraction_coeff : float, optional
    Refraction coefficient (with flag -r)
    Allowed values: 0.0-1.0
    Default: 0.14286
name_column : str, optional
    Database column for point names (with flag -k)
    Used as: input, dbcolumn, name
flags : str, optional
    Allowed values: k, c, r, b, e
    k
        Keep all interim viewshed maps produced by the routine (maps will be named "vshed_'name'_uniquenumber", where 'name' is the value in "name_column" for each input point. If no value specified in "name_column", cat value will be used instead)
    c
        Consider the curvature of the earth (current ellipsoid)
    r
        Consider the effect of atmospheric refraction
    b
        Output format is {0 (invisible) 1 (visible)}
    e
        Output format is invisible = NULL, else current elev - viewpoint_elev
overwrite: bool, optional
    Allow output files to overwrite existing files
    Default: False
verbose: bool, optional
    Verbose module output
    Default: False
quiet: bool, optional
    Quiet module output
    Default: False
superquiet: bool, optional
    Very quiet module output
    Default: False

DESCRIPTION

r.viewshed.cva is a module that allows for the construction of "Cumulative Viewshed", or "visualscape" maps from a series of input points stored in a vector points map. The routine is a python wrapper script that iterative loops through each input point, calculating a viewshed map, and then creates an output map that is coded by the number of input locations that can "see" each cell. r.viewshed.cva uses the GRASS GIS module r.viewshed for the viewshed analysis. r.viewshed is very fast, thus allowing for a cumulative viewshed analysis to run in a reasonable amount of time. The final cumulative viewshed map is computed using the "count" method of r.series, rather than with mapcalc, as it better handles the null values in the individual constituent viewshed maps (and allows for interim viewshed maps to be coded in any way).

Options and flags

r.viewshed.cva requires an input elevation map, input, and an input vector points map, vector. There is currently only one native flag for r.viewshed.cva, -k, which allows you to keep the interim viewshed maps made for each input point. Optionally, option name_column can be used with -k to specify the suffix of the kept viewshed maps by a particular column in the input vector points' database. If no value is specified for name_column, then the cat value will be used.

All other flags and options are inherited from r.viewshed (see the r.viewshed help page for more information on these).

NOTES

The input vector points map can be manually digitized (with v.digit) over topographic or cultural features, or can be created as a series of random points (with r.random or v.random). Note that using the flag -k allows you to keep any interim viewshed maps created during the analysis, and these resultant viewshed maps will be named according to the cat number of the original input points. This is also useful for simple creating a large number of individual viewsheds from points in a vector file.

An automated summit extraction can be done with r.geomorphon.

EXAMPLES

Undertake a cumulative viewshed analysis from a digitized vector points map of prominent peaks in a region (North Carolina sample dataset):

g.region raster=elevation -p
# use v.digit to digitize points or e.g. the r.geomorphon addon for summits
r.viewshed.cva input=elevation output=peaks_CVA_map \
  vector=prominent_peaks_points name_column=cat \
  observer_elevation=1.75 target_elevation=0

Undertake a cumulative viewshed analysis from a 10% sample of landscape locations in a region:

g.region raster=elevation -p
r.random input=elevation n=10% vector=rand_points_10p
r.viewshed.cva input=elevation output=peaks_CVA_map \
  vector=rand_points_10p name_column=cat \
  observer_elevation=1.75 target_elevation=0

SEE ALSO

r.geomorphon, r.viewshed

AUTHOR

Isaac Ullah

SOURCE CODE

Available at: r.viewshed.cva source code (history)
Latest change: Wednesday Feb 26 13:08:15 2025 in commit 40dada2