Debian Codegraph @

raster/r.grow.distance/r.grow.distance.html

raw
1 <h2>DESCRIPTION</h2>
2
3 <em>r.grow.distance</em> generates raster maps representing the
4 distance to the nearest non-null cell in the input map and/or the
5 value of the nearest non-null cell.
6
7 <h2>NOTES</h2>
8
9 The flag <b>-n</b> calculates the respective pixel distances to the
10 nearest NULL cell.
11 <p>
12 The user has the option of specifying five different metrics which
13 control the geometry in which grown cells are created, (controlled by
14 the <b>metric</b> parameter): <i>Euclidean</i>, <i>Squared</i>,
15 <i>Manhattan</i>, <i>Maximum</i>, and <i>Geodesic</i>.
16
17 <p>
18 The <i>Euclidean distance</i> or <i>Euclidean metric</i> is the "ordinary" distance
19 between two points that one would measure with a ruler, which can be
20 proven by repeated application of the Pythagorean theorem.
21 The formula is given by:
22
23 <div class="code"><pre>
24 d(dx,dy) = sqrt(dx^2 + dy^2)
25 </pre></div>
26
27 Cells grown using this metric would form isolines of distance that are
28 circular from a given point, with the distance given by the <b>radius</b>.
29
30 <p>
31 The <i>Squared</i> metric is the <i>Euclidean</i> distance squared,
32 i.e. it simply omits the square-root calculation. This may be faster,
33 and is sufficient if only relative values are required.
34
35 <p>
36 The <i>Manhattan metric</i>, or <i>Taxicab geometry</i>, is a form of geometry in
37 which the usual metric of Euclidean geometry is replaced by a new
38 metric in which the distance between two points is the sum of the (absolute)
39 differences of their coordinates. The name alludes to the grid layout of
40 most streets on the island of Manhattan, which causes the shortest path a
41 car could take between two points in the city to have length equal to the
42 points' distance in taxicab geometry.
43 The formula is given by:
44
45 <div class="code"><pre>
46 d(dx,dy) = abs(dx) + abs(dy)
47 </pre></div>
48
49 where cells grown using this metric would form isolines of distance that are
50 rhombus-shaped from a given point.
51
52 <p>
53 The <i>Maximum metric</i> is given by the formula
54
55 <div class="code"><pre>
56 d(dx,dy) = max(abs(dx),abs(dy))
57 </pre></div>
58
59 where the isolines of distance from a point are squares.
60
61 <p>
62 The <i>Geodesic metric</i> is calculated as geodesic distance, to
63 be used only in latitude-longitude coordinate reference system. It is recommended
64 to use it along with the <em>-m</em> flag in order to output
65 distances in meters instead of map units.
66
67 <p>
68 If <b>minimum_distance</b> is given, all cells with a distance smaller
69 than <b>minimum_distance</b> will be set to NULL.
70
71 <p>
72 If <b>maximum_distance</b> is given, all cells with a distance larger
73 than <b>maximum_distance</b> will be set to NULL. The resultant output
74 is equivalent to a buffer.
75
76 <p>
77 If both <b>minimum_distance</b> and <b>maximum_distance</b> are given,
78 the result will be similar to a doughnut, a restricted belt for a
79 given distance range. All cells outside this distance range will be set
80 to NULL.
81
82 <h2>EXAMPLES</h2>
83
84 <h3>Distance from the streams network</h3>
85
86 North Carolina sample dataset:
87 <div class="code"><pre>
88 g.region raster=streams_derived -p
89 r.grow.distance input=streams_derived distance=dist_from_streams
90 r.colors map=dist_from_streams color=rainbow
91 </pre></div>
92
93 <div align="center" style="margin: 10px">
94 <img src="r_grow_distance.png" border="0"><br>
95 <i>Euclidean distance from the streams network in meters (map subset)</i>
96 </div>
97
98 <div align="center" style="margin: 10px">
99 <img src="r_grow_distance_zoom.png" border="0"><br>
100 <i>Euclidean distance from the streams network in meters (detail, numbers shown
101 with d.rast.num)</i>
102 </div>
103
104 <h3>Distance from sea in meters in latitude-longitude CRS</h3>
105
106 <div class="code"><pre>
107 g.region raster=sea -p
108 r.grow.distance -m input=sea distance=dist_from_sea_geodetic metric=geodesic
109 r.colors map=dist_from_sea_geodetic color=rainbow
110 </pre></div>
111
112 <p>
113 <center>
114 <img src="r_grow_distance_sea.png" border="1"><br>
115 <i>Geodesic distances to sea in meters</i>
116 </center>
117
118 <h2>SEE ALSO</h2>
119
120 <em>
121 <a href="r.grow.html">r.grow</a>,
122 <a href="r.distance.html">r.distance</a>,
123 <a href="r.buffer.html">r.buffer</a>,
124 <a href="r.cost.html">r.cost</a>,
125 <a href="r.patch.html">r.patch</a>
126 </em>
127
128 <p>
129 <em>
130 <a href="https://en.wikipedia.org/wiki/Euclidean_metric">Wikipedia Entry:
131 Euclidean Metric</a><br>
132 <a href="https://en.wikipedia.org/wiki/Manhattan_metric">Wikipedia Entry:
133 Manhattan Metric</a>
134 </em>
135
136 <h2>AUTHOR</h2>
137
138 Glynn Clements