NAME
v.net.visibility - Performs visibility graph construction.
KEYWORDS
vector, network, shortest path, visibility
SYNOPSIS
v.net.visibility
v.net.visibility --help
v.net.visibility input=name output=name [coordinates=east,north] [visibility=name] [--overwrite] [--help] [--verbose] [--quiet] [--ui]
Flags:
- --overwrite
-
Allow output files to overwrite existing files
- --help
-
Print usage summary
- --verbose
-
Verbose module output
- --quiet
-
Quiet module output
- --ui
-
Force launching GUI dialog
Parameters:
- input=name [required]
-
Name of input vector map
Or data source for direct OGR access
- output=name [required]
-
Name for output vector map
- coordinates=east,north
-
Coordinates
- visibility=name
-
Name of input vector map containing visible points
Add points after computing the visibility graph
DESCRIPTION
v.net.visibility computes the visibility graph of a vector map containing lines, areas (boundaries) and points. The visibility graph is the graph where the nodes are the end point of the lines, boundaries or simply points. There is an edge between two nodes if they are ’visible’ to each other. Two nodes are visibible if there are no segments in between of them, i.e. the edge does not intersect any line or boundary in the vector map. This is useful to compute the shortest path in a vector map from any two points. To do this, first you need to compute the visibility graph and from that to compute the shortest path using v.net.path or d.path.
IMPORTANT: the algorithm doesn’t work well with intersecting lines (that includes overlapping)
NOTES
If you compute a shortest path after computing the visibility graph you will notice that this path might go through a vertex of a line. If this is not what you wanted you might need to process the map in v.buffer, initially with a small value. Example:
v.buffer input=map output=bufferedmap buffer=1 type=point,line,area,boundary
The first argument is the input map. It supports lines, boundaries (so, areas) and points. For the algorithm was written to work with lines and boundaries not intersecting each other (that includes overlapping).
The resulting map containing the visibility graph is given in the output map.
If you need to add additional points to compute a shortest path between them afterwards you can use the coordinates parameter, e.g.:
coordinates=25556200,6686400,25556400,6686600
where 25556200,6686400 are the coordinate of the first point and 25556400,6686600 are the coordinates of the second point. Of course you can give as many points as you need. They will be added to the visibility graph and edges from them will be computed. You can always add those points after computing the visibility graph. Simply use the visibility parameter. The input will be the original vector map, the vis will be the computed visibility graph and the output the new visibility graph which will be the vis + the new points given with coordinate (edges will be computed as well).
v.net.visibility input=map visibility=vis_map output=new_vis_map \coordinates=25556200,6686400,25556400,6686600
EXAMPLES
Example 1
A simple example (North Carolina sample data) showing how to use the module:
v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25g.region vector=zipcodes_waked.mon wx0d.vect areas_7_11_25v.net.visibility input=areas_7_11_25 output=graphd.vect graphd.vect areas_7_11_25 color=red type=boundary
Example 2
An example on how to use v.buffer along with the module:
v.buffer input=lines output=buffered_lines buffer=1v.net.visibility input=buffered_lines output=graphd.vect graphd.vect lines col=red
Example 3
An example on how to use the coordinate parameter. This will compute the visibility graph of the vector map lines with the point 2555678,6686343:
v.net.visibility input=lines output=graph coordinates=2555678,6686343d.vect graphd.vect lines col=red
Example 4
An example (North Carolina sample data) on how to use the coordinate parameter with the vis parameter. Here the vector map graph is computed then a new visibility graph is computed from it with the point 669547.97,208348.20 extra:
v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25g.region vector=zipcodes_waked.mon wx0d.vect areas_7_11_25v.net.visibility input=areas_7_11_25 output=graphv.net.visibility input=areas_7_11_25 visibility=graph output=new_graph \coordinates=669547.97,208348.20d.erased.vect areas_7_11_25echo "symbol basic/star 20 669547.97 208348.20 black red" | d.graph -md.vect new_graphd.vect areas_7_11_25 color=red type=boundary
Example 5
An example for connections of points (Spearfish):
v.net.visibility input=archsites output=graphg.region vector=archsitesd.mon wx0d.vect graphd.vect archsites col=red
Example 6
Here is an example with artificial data.
Load data using here document syntax (Bash and unix-like commands lines only):
v.in.ascii input=- output=simple format=standard <<EOFVERTI:B 682.19908257 75.2178899181.67889908 71.4032110183.58623853 71.7252293684.3293578 75.2178899182.24862385 76.0600917482.19908257 75.21788991C 1 182.88897401 73.663187821 1C 1 190.72645705 75.612486751 2C 1 189.37944702 69.510129121 3C 1 181.60108979 67.786697251 4B 589.92752294 73.9545871692.37981651 75.1188073491.56238532 77.2986238588.96146789 75.8866972589.92752294 73.95458716B 1088.54036697 70.7096330387.92192518 70.0408741787.89633028 69.0004587288.66460807 68.1337286790.15108904 68.2329082190.9426344 68.9758820290.86880734 70.1151376190.00144697 70.7833631289.06055046 70.9573394588.54036697 70.70963303B 978.73119266 71.3536697280.76238532 68.9013761584.20550459 66.9197247789.87798165 65.3591743183.23494031 66.2768517580.34278748 68.0083723878.38484005 71.4029200978.40917431 72.2701834978.73119266 71.35366972EOF
Compute the graph:
v.net.visibility input=simple output=graph
KNOWN ISSUES
In some cases when 3 points or nodes are collinear, some wrong edges are added. This happens only really rarly and shouldn’t be a big problem. When two points have the exact same x coordinate and are visible, some wrong edges are added.
SEE ALSO
d.path, v.net, v.net.alloc, v.net.iso, v.net.salesman, v.net.steiner, v.to.db
AUTHORS
Maximilian Maldacker
Mentor: Wolf Bergenheim
SOURCE CODE
Available at: v.net.visibility source code (history)
Accessed: Monday Feb 24 17:51:20 2025
Main index | Vector index | Topics index | Keywords index | Graphical index | Full index
© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual