.TH r.patch 1grass "" "GRASS 6.4.4" "Grass User's Manual"
.SH NAME
\fI\fBr.patch\fR\fR  - Creates a composite raster map layer by using known category values from one (or more) map layer(s) to fill in areas of "no data" in another map layer.
.SH KEYWORDS
raster, geometry
.SH SYNOPSIS
\fBr.patch\fR
.br
\fBr.patch help\fR
.br
\fBr.patch\fR [\-\fBqz\fR] \fBinput\fR=\fIname\fR[,\fIname\fR,...] \fBoutput\fR=\fIname\fR  [\-\-\fBoverwrite\fR]  [\-\-\fBverbose\fR]  [\-\-\fBquiet\fR] 
.SS Flags:
.IP "\fB\-q\fR" 4m
.br
Quiet
.IP "\fB\-z\fR" 4m
.br
Use zero (0) for transparency instead of NULL
.IP "\fB\-\-overwrite\fR" 4m
.br
Allow output files to overwrite existing files
.IP "\fB\-\-verbose\fR" 4m
.br
Verbose module output
.IP "\fB\-\-quiet\fR" 4m
.br
Quiet module output
.PP
.SS Parameters:
.IP "\fBinput\fR=\fIname[,\fIname\fR,...]\fR" 4m
.br
Name of raster maps to be patched together
.IP "\fBoutput\fR=\fIname\fR" 4m
.br
Name for resultant raster map
.PP
.SH DESCRIPTION
The GRASS program \fIr.patch\fR allows the user to build a new
raster map the size and resolution of the current region by assigning
known data values from input raster maps to the cells in this region.
This is done by filling in "no data" cells, those that do not yet
contain data, contain NULL data, or, optionally contain 0 data,
with the data from the first input map.
Once this is done the remaining holes are filled in by the next input map,
and so on.
This program
is useful for making a composite raster map layer from two or more adjacent
map layers, for filling in "holes" in a raster map layer's data (e.g., in
digital elevation data), or for updating an older map layer with more recent
data. The current geographic region definition and mask settings are
respected.
.PP
The first \fIname\fR listed in the string
\fBinput=\fR\fIname\fR,\fIname\fR,\fIname\fR, ... is the name of
the first map whose data values will be used to fill in "no data" cells
in the current region. The second through last input \fIname\fR
maps will be used, in order, to supply data values for for the remaining
\(dqno data" cells.
.SH EXAMPLE
Below, the raster map layer on the far left is \fBpatched\fR 
with the middle (\fIpatching\fR) raster map layer, 
to produce the \fIcomposite\fR raster map layer on the right. 
\fC
.DS
.br
  1 1 1 0 2 2 0 0    0 0 1 1 0 0 0 0    1 1 1 1 2 2 0 0
.br
  1 1 0 2 2 2 0 0    0 0 1 1 0 0 0 0    1 1 1 2 2 2 0 0
.br
  3 3 3 3 2 2 0 0    0 0 0 0 0 0 0 0    3 3 3 3 2 2 0 0
.br
  3 3 3 3 0 0 0 0    4 4 4 4 4 4 4 4    3 3 3 3 4 4 4 4
.br
  3 3 3 0 0 0 0 0    4 4 4 4 4 4 4 4    3 3 3 4 4 4 4 4
.br
  0 0 0 0 0 0 0 0    4 4 4 4 4 4 4 4    4 4 4 4 4 4 4 4
.br
.DE
\fR
Switching the \fIpatched\fR and the \fIpatching\fR raster map layers 
produces the following results: 
\fC
.DS
.br
  0 0 1 1 0 0 0 0    1 1 1 0 2 2 0 0    1 1 1 1 2 2 0 0
.br
  0 0 1 1 0 0 0 0    1 1 0 2 2 2 0 0    1 1 1 1 2 2 0 0
.br
  0 0 0 0 0 0 0 0    3 3 3 3 2 2 0 0    3 3 3 3 2 2 0 0
.br
  4 4 4 4 4 4 4 4    3 3 3 3 0 0 0 0    4 4 4 4 4 4 4 4
.br
  4 4 4 4 4 4 4 4    3 3 3 0 0 0 0 0    4 4 4 4 4 4 4 4
.br
  4 4 4 4 4 4 4 4    0 0 0 0 0 0 0 0    4 4 4 4 4 4 4 4
.br
.DE
\fR
.SH NOTES
Frequently, this program is used to patch together adjacent map layers which
have been digitized separately.  The program 
\fIv.mkgrid\fR can be used to make adjacent
maps align neatly.
.PP
The user should check the current geographic region settings before running 
\fIr.patch\fR, to ensure that the region boundaries encompass all 
of the data desired to be included in the composite map and to ensure that the
region resolution is the resolution of the desired data. To set the
geographic region settings to one or several raster maps, the \fIg.region\fR
program can be used:
\fC
.DS
.br
g.region rast=map1[,map2[,...]]
.br
.DE
\fR
.PP
Use of \fIr.patch\fR is generally followed by use of the GRASS programs 
\fIg.remove\fR and 
\fIg.rename\fR;
\fIg.remove\fR is used to remove the original (un-patched) raster map
layers, while \fIg.rename\fR is used to then assign to the newly-created
composite (patched) raster map layer the name of the original raster map
layer.
.PP
\fIr.patch\fR creates support files for the patched, composite output map. 
.SH EXAMPLE
Create a list of maps matching a pattern, extend the region to include them
all, and patch them together to create a mosaic. Overlapping maps will be 
used in the order listed.
\fC
.DS
.br
MAPS=\(gag.mlist type=rast sep=, pat="map_*"\(ga
.br
g.region rast=$MAPS
.br
r.patch in=$MAPS out=mosaic
.br
.DE
\fR
.br
.SH SEE ALSO
\fIg.region\fR,
\fIg.remove\fR,
\fIg.rename\fR,
\fIr.mapcalc\fR,
\fIr.support\fR,
\fIv.mkgrid\fR
.SH AUTHOR
Michael Shapiro, 
U.S. Army Construction Engineering Research Laboratory
.br
-z flag by Huidae Cho
.PP
\fILast changed: $Date: 2011-11-08 12:29:50 +0100 (Tue, 08 Nov 2011) $\fR
.PP
Full index
.PP
© 2003-2014 GRASS Development Team
