~grass/grass/releasebranch_7_0

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<h2>DESCRIPTION</h2>

<em>r.grow.distance</em> generates raster maps representing the
distance to the nearest non-null cell in the input map and/or the
value of the nearest non-null cell.

<h2>NOTES</h2>

The user has the option of specifying five different metrics which
control the geometry in which grown cells are created, (controlled by
the <b>metric</b> parameter): <i>Euclidean</i>, <i>Squared</i>,
<i>Manhattan</i>, <i>Maximum</i>, and <i>Geodesic</i>.

<p>
The <i>Euclidean distance</i> or <i>Euclidean metric</i> is the "ordinary" distance 
between two points that one would measure with a ruler, which can be 
proven by repeated application of the Pythagorean theorem. 
The formula is given by: 

<div class="code"><pre>
d(dx,dy) = sqrt(dx^2 + dy^2)
</pre></div>

Cells grown using this metric would form isolines of distance that are
circular from a given point, with the distance given by the <b>radius</b>.

<p>
The <i>Squared</i> metric is the <i>Euclidean</i> distance squared,
i.e. it simply omits the square-root calculation. This may be faster,
and is sufficient if only relative values are required.

<p>
The <i>Manhattan metric</i>, or <i>Taxicab geometry</i>, is a form of geometry in 
which the usual metric of Euclidean geometry is replaced by a new 
metric in which the distance between two points is the sum of the (absolute) 
differences of their coordinates. The name alludes to the grid layout of 
most streets on the island of Manhattan, which causes the shortest path a 
car could take between two points in the city to have length equal to the
points' distance in taxicab geometry.
The formula is given by:

<div class="code"><pre>
d(dx,dy) = abs(dx) + abs(dy)
</pre></div>

where cells grown using this metric would form isolines of distance that are
rhombus-shaped from a given point. 

<p>
The <i>Maximum metric</i> is given by the formula

<div class="code"><pre>
d(dx,dy) = max(abs(dx),abs(dy))
</pre></div>

where the isolines of distance from a point are squares.

<p>
The <i>Geodesic metric</i> is calculated as geodesic distance, to 
be used only in latitude-longitude locations. It is recommended 
to use it along with the <em>-m</em> flag in order to output 
distances in meters instead of map units.

<h2>EXAMPLES</h2>

<h3>Distance from the streams network</h3>

North Carolina sample dataset:
<div class="code"><pre>
g.region raster=streams_derived -p
r.grow.distance input=streams_derived distance=dist_from_streams
</pre></div>

<div align="center" style="margin: 10px">
<img src="r_grow_distance.png" border=0><br>
<i>Euclidean distance from the streams network in meters (map subset)</i>
</div>

<div align="center" style="margin: 10px">
<img src="r_grow_distance_zoom.png" border=0><br>
<i>Euclidean distance from the streams network in meters (detail, numbers shown
   with d.rast.num)</i>
</div>

<h3>Distance from sea in meters in latitude-longitude location</h3>

<div class="code"><pre>
g.region raster=sea -p
r.grow.distance -m input=sea distance=dist_from_sea_geodetic metric=geodesic
</pre></div>

<p>
<center>
<img src="r_grow_distance_sea.png" border=1><br>
<i>Geodesic distances to sea in meters</i>
</center>

<h2>SEE ALSO</h2>

<em>
<a href="r.grow.html">r.grow</a>,
<a href="r.distance.html">r.distance</a>,
<a href="r.buffer.html">r.buffer</a>,
<a href="r.cost.html">r.cost</a>,
<a href="r.patch.html">r.patch</a>
</em>

<p>
<em>
<a href="http://en.wikipedia.org/wiki/Euclidean_metric">Wikipedia Entry:
    Euclidean Metric</a><br>
<a href="http://en.wikipedia.org/wiki/Manhattan_metric">Wikipedia Entry:
    Manhattan Metric</a>
</em>


<h2>AUTHORS</h2>

Glynn Clements

<p>
<i>Last changed: $Date$</i>