3
The GRASS program <em>r.patch</em> allows the user to build a new
4
raster map the size and resolution of the current region by assigning
5
known data values from input raster maps to the cells in this region.
6
This is done by filling in "no data" cells, those that do not yet
7
contain data, contain NULL data, or, optionally contain 0 data,
8
with the data from the first input map.
9
Once this is done the remaining holes are filled in by the next input map,
12
is useful for making a composite raster map layer from two or more adjacent
13
map layers, for filling in "holes" in a raster map layer's data (e.g., in
14
digital elevation data), or for updating an older map layer with more recent
15
data. The current geographic region definition and mask settings are
18
The first <em>name</em> listed in the string
19
<b>input=</b><em>name</em>,<em>name</em>,<em>name</em>, ... is the name of
20
the first map whose data values will be used to fill in "no data" cells
21
in the current region. The second through last input <em>name</em>
22
maps will be used, in order, to supply data values for for the remaining
27
Below, the raster map layer on the far left is <b>patched</b>
28
with the middle (<em>patching</em>) raster map layer,
29
to produce the <em>composite</em> raster map layer on the right.
32
1 1 1 0 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 1 2 2 0 0
33
1 1 0 2 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 2 2 2 0 0
34
3 3 3 3 2 2 0 0 0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0
35
3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 3 4 4 4 4
36
3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4
37
0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
40
Switching the <em>patched</em> and the <em>patching</em> raster map layers
41
produces the following results:
44
0 0 1 1 0 0 0 0 1 1 1 0 2 2 0 0 1 1 1 1 2 2 0 0
45
0 0 1 1 0 0 0 0 1 1 0 2 2 2 0 0 1 1 1 1 2 2 0 0
46
0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0 3 3 3 3 2 2 0 0
47
4 4 4 4 4 4 4 4 3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4
48
4 4 4 4 4 4 4 4 3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4
49
4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4
54
Frequently, this program is used to patch together adjacent map layers which
55
have been digitized separately. The program
56
<em><a href="v.mkgrid.html">v.mkgrid</a></em> can be used to make adjacent
60
The user should check the current geographic region settings before running
61
<em>r.patch</em>, to ensure that the region boundaries encompass all
62
of the data desired to be included in the composite map and to ensure that the
63
region resolution is the resolution of the desired data. To set the
64
geographic region settings to one or several raster maps, the <em>g.region</em>
67
<div class="code"><pre>
68
g.region rast=map1[,map2[,...]]
73
Use of <em>r.patch</em> is generally followed by use of the GRASS programs
74
<em><a href="g.remove.html">g.remove</a></em> and
75
<em><a href="g.rename.html">g.rename</a></em>;
76
<em>g.remove</em> is used to remove the original (un-patched) raster map
77
layers, while <em>g.rename</em> is used to then assign to the newly-created
78
composite (patched) raster map layer the name of the original raster map
82
<em>r.patch</em> creates support files for the patched, composite output map.
87
Create a list of maps matching a pattern, extend the region to include them
88
all, and patch them together to create a mosaic. Overlapping maps will be
89
used in the order listed.
91
<div class="code"><pre>
92
MAPS=`g.mlist type=rast sep=, pat="map_*"`
94
r.patch in=$MAPS out=mosaic
101
<em><a href="g.region.html">g.region</a></em>,
102
<em><a href="g.remove.html">g.remove</a></em>,
103
<em><a href="g.rename.html">g.rename</a></em>,
104
<em><a href="r.mapcalc.html">r.mapcalc</a></em>,
105
<em><a href="r.support.html">r.support</a></em>,
106
<em><a href="v.mkgrid.html">v.mkgrid</a></em>
111
U.S. Army Construction Engineering Research Laboratory
113
-z flag by Huidae Cho
115
<p><i>Last changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $</i>