| 1 |
<h2>DESCRIPTION</h2> |
| 2 |
|
| 3 |
<em>v.net.visibility</em> computes the visibility graph of a vector |
| 4 |
map containing lines, areas (boundaries) and points. The visibility |
| 5 |
graph is the graph where the nodes are the end point of the lines, |
| 6 |
boundaries or simply points. There is an edge between two nodes if they |
| 7 |
are 'visible' to each other. Two nodes are visibible if there are no segments |
| 8 |
in between of them, i.e. the edge does not intersect any line or boundary |
| 9 |
in the vector map. This is useful to compute the shortest path in a |
| 10 |
vector map from any two points. To do this, first you need to compute |
| 11 |
the visibility graph and from that to compute the shortest path using |
| 12 |
<em><a href="v.net.path.html">v.net.path</a></em> |
| 13 |
or <em><a href="d.path.html">d.path</a></em>. |
| 14 |
|
| 15 |
<p> |
| 16 |
<b>IMPORTANT: the algorithm doesn't work well with intersecting lines |
| 17 |
(that includes overlapping)</b> |
| 18 |
|
| 19 |
<h2>NOTES</h2> |
| 20 |
|
| 21 |
If you compute a shortest path after computing the visibility graph |
| 22 |
you will notice that this path might go through a vertex of a line. If |
| 23 |
this is not what you wanted you might need to process the map |
| 24 |
in <em><a href="v.buffer.html">v.buffer</a></em>, initially with a |
| 25 |
small value. Example: |
| 26 |
|
| 27 |
<div class="code"><pre> |
| 28 |
v.buffer input=map output=bufferedmap buffer=1 type=point,line,area,boundary |
| 29 |
</pre></div> |
| 30 |
|
| 31 |
<p> |
| 32 |
The first argument is the input map. It supports lines, boundaries |
| 33 |
(so, areas) and points. For the algorithm was written to work with lines |
| 34 |
and boundaries not intersecting each other (that includes overlapping). |
| 35 |
<br> |
| 36 |
The resulting map containing the visibility graph is given in the output map. |
| 37 |
<p> |
| 38 |
If you need to add additional points to compute a shortest path |
| 39 |
between them afterwards you can use the <b>coordinates</b> parameter, e.g.: |
| 40 |
<div class="code"><pre> |
| 41 |
coordinates=25556200,6686400,25556400,6686600 |
| 42 |
</pre></div> |
| 43 |
where 25556200,6686400 are the coordinate of the first point and |
| 44 |
25556400,6686600 are the coordinates of the second point. Of course |
| 45 |
you can give as many points as you need. They will be added to the |
| 46 |
visibility graph and edges from them will be computed. You can |
| 47 |
always add those points after computing the visibility graph. Simply |
| 48 |
use the <b>visibility</b> parameter. The input will be the original |
| 49 |
vector map, the vis will be the computed visibility graph and the |
| 50 |
output the new visibility graph which will be the vis + the new |
| 51 |
points given with coordinate (edges will be computed as well). |
| 52 |
<div class="code"><pre> |
| 53 |
v.net.visibility input=map visibility=vis_map output=new_vis_map \ |
| 54 |
coordinates=25556200,6686400,25556400,6686600 |
| 55 |
</pre></div> |
| 56 |
|
| 57 |
<h2>EXAMPLES</h2> |
| 58 |
|
| 59 |
<h3>Example 1</h3> |
| 60 |
|
| 61 |
<!-- still overly complex result, some simple geometric were better --> |
| 62 |
A simple example (North Carolina sample data) showing how to use the module: |
| 63 |
<div class="code"><pre> |
| 64 |
v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25 |
| 65 |
g.region vector=zipcodes_wake |
| 66 |
d.mon wx0 |
| 67 |
d.vect areas_7_11_25 |
| 68 |
v.net.visibility input=areas_7_11_25 output=graph |
| 69 |
d.vect graph |
| 70 |
d.vect areas_7_11_25 color=red type=boundary |
| 71 |
</pre></div> |
| 72 |
|
| 73 |
<h3>Example 2</h3> |
| 74 |
|
| 75 |
An example on how to use <em><a href="v.buffer.html">v.buffer</a></em> |
| 76 |
along with the module: |
| 77 |
<div class="code"><pre> |
| 78 |
v.buffer input=lines output=buffered_lines buffer=1 |
| 79 |
v.net.visibility input=buffered_lines output=graph |
| 80 |
d.vect graph |
| 81 |
d.vect lines col=red |
| 82 |
</pre></div> |
| 83 |
|
| 84 |
<h3>Example 3</h3> |
| 85 |
|
| 86 |
An example on how to use the coordinate parameter. This will compute the |
| 87 |
visibility graph of the vector map lines with the point 2555678,6686343: |
| 88 |
<div class="code"><pre> |
| 89 |
v.net.visibility input=lines output=graph coordinates=2555678,6686343 |
| 90 |
d.vect graph |
| 91 |
d.vect lines col=red |
| 92 |
</pre></div> |
| 93 |
|
| 94 |
<h3>Example 4</h3> |
| 95 |
|
| 96 |
<!-- does not quite work yet? --> |
| 97 |
An example (North Carolina sample data) on how to use the coordinate |
| 98 |
parameter with the vis parameter. |
| 99 |
Here the vector map graph is computed then a new visibility graph is computed |
| 100 |
from it with the point 669547.97,208348.20 extra: |
| 101 |
<div class="code"><pre> |
| 102 |
v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25 |
| 103 |
g.region vector=zipcodes_wake |
| 104 |
d.mon wx0 |
| 105 |
d.vect areas_7_11_25 |
| 106 |
v.net.visibility input=areas_7_11_25 output=graph |
| 107 |
v.net.visibility input=areas_7_11_25 visibility=graph output=new_graph \ |
| 108 |
coordinates=669547.97,208348.20 |
| 109 |
d.erase |
| 110 |
d.vect areas_7_11_25 |
| 111 |
echo "symbol basic/star 20 669547.97 208348.20 black red" | d.graph -m |
| 112 |
d.vect new_graph |
| 113 |
d.vect areas_7_11_25 color=red type=boundary |
| 114 |
</pre></div> |
| 115 |
|
| 116 |
<h3>Example 5</h3> |
| 117 |
|
| 118 |
An example for connections of points (Spearfish): |
| 119 |
<div class="code"><pre> |
| 120 |
v.net.visibility input=archsites output=graph |
| 121 |
g.region vector=archsites |
| 122 |
d.mon wx0 |
| 123 |
d.vect graph |
| 124 |
d.vect archsites col=red |
| 125 |
</pre></div> |
| 126 |
|
| 127 |
<h3>Example 6</h3> |
| 128 |
|
| 129 |
Here is an example with artificial data. |
| 130 |
|
| 131 |
<p> |
| 132 |
<img src="v_net_visibility.png"> |
| 133 |
|
| 134 |
<p> |
| 135 |
Load data using here document syntax (Bash and unix-like commands lines only): |
| 136 |
|
| 137 |
<div class="code"><pre> |
| 138 |
v.in.ascii input=- output=simple format=standard <<EOF |
| 139 |
VERTI: |
| 140 |
B 6 |
| 141 |
82.19908257 75.21788991 |
| 142 |
81.67889908 71.40321101 |
| 143 |
83.58623853 71.72522936 |
| 144 |
84.3293578 75.21788991 |
| 145 |
82.24862385 76.06009174 |
| 146 |
82.19908257 75.21788991 |
| 147 |
C 1 1 |
| 148 |
82.88897401 73.66318782 |
| 149 |
1 1 |
| 150 |
C 1 1 |
| 151 |
90.72645705 75.61248675 |
| 152 |
1 2 |
| 153 |
C 1 1 |
| 154 |
89.37944702 69.51012912 |
| 155 |
1 3 |
| 156 |
C 1 1 |
| 157 |
81.60108979 67.78669725 |
| 158 |
1 4 |
| 159 |
B 5 |
| 160 |
89.92752294 73.95458716 |
| 161 |
92.37981651 75.11880734 |
| 162 |
91.56238532 77.29862385 |
| 163 |
88.96146789 75.88669725 |
| 164 |
89.92752294 73.95458716 |
| 165 |
B 10 |
| 166 |
88.54036697 70.70963303 |
| 167 |
87.92192518 70.04087417 |
| 168 |
87.89633028 69.00045872 |
| 169 |
88.66460807 68.13372867 |
| 170 |
90.15108904 68.23290821 |
| 171 |
90.9426344 68.97588202 |
| 172 |
90.86880734 70.11513761 |
| 173 |
90.00144697 70.78336312 |
| 174 |
89.06055046 70.95733945 |
| 175 |
88.54036697 70.70963303 |
| 176 |
B 9 |
| 177 |
78.73119266 71.35366972 |
| 178 |
80.76238532 68.90137615 |
| 179 |
84.20550459 66.91972477 |
| 180 |
89.87798165 65.35917431 |
| 181 |
83.23494031 66.27685175 |
| 182 |
80.34278748 68.00837238 |
| 183 |
78.38484005 71.40292009 |
| 184 |
78.40917431 72.27018349 |
| 185 |
78.73119266 71.35366972 |
| 186 |
EOF |
| 187 |
</pre></div> |
| 188 |
|
| 189 |
Compute the graph: |
| 190 |
|
| 191 |
<div class="code"><pre> |
| 192 |
v.net.visibility input=simple output=graph |
| 193 |
</pre></div> |
| 194 |
|
| 195 |
<h2>KNOWN ISSUES</h2> |
| 196 |
|
| 197 |
In some cases when 3 points or nodes are collinear, some wrong edges |
| 198 |
are added. This happens only really rarly and shouldn't be a big |
| 199 |
problem. When two points have the exact same x coordinate and are |
| 200 |
visible, some wrong edges are added. |
| 201 |
|
| 202 |
<h2>SEE ALSO</h2> |
| 203 |
|
| 204 |
<em> |
| 205 |
<a href="d.path.html">d.path</a>, |
| 206 |
<a href="v.net.html">v.net</a>, |
| 207 |
<a href="v.net.alloc.html">v.net.alloc</a>, |
| 208 |
<a href="v.net.iso.html">v.net.iso</a>, |
| 209 |
<a href="v.net.salesman.html">v.net.salesman</a>, |
| 210 |
<a href="v.net.steiner.html">v.net.steiner</a>, |
| 211 |
<a href="v.to.db.html">v.to.db</a> |
| 212 |
</em> |
| 213 |
|
| 214 |
<h2>AUTHORS</h2> |
| 215 |
|
| 216 |
Maximilian Maldacker<br> |
| 217 |
Mentor: Wolf Bergenheim |