NAME
r.patch - 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.
(GRASS Raster Program)
SYNOPSIS
r.patch
r.patch help
r.patch
[-qz] input=name[,name,...]
output=name
DESCRIPTION
The GRASS program
r.patch
allows the user to assign known data values from other raster map layers
to the "no data" areas (those assigned category value NULL/0)
in another raster map layer.
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 program will be run non-interactively if the user specifies
program arguments on the command line, using the form:
-
r.patch
[-qz] input=name[,name,...]
output=name
where each input name is the name of a raster map layer to be patched,
the output name is the name assigned to the new composite raster map
layer containing the patched result,
and the (optional) -q flag directs r.patch to run quietly.
The first name listed in the string
input=name,name,name, ...
is the name of the base map whose zero data values will be attempted
to be filled by non-zero data values in the second through tenth
input name maps listed.
The second through tenth input name maps
will be used to supply remaining missing (zero) data values for the
first input map name,
based on the order in which they are listed in the string
input=name,name,name, ...
Alternately, the user can simply type r.patch on the command line,
without program arguments. In this case, the user will be prompted for the
flag setting and parameter values using the standard GRASS
parser interface.
Flag:
- -q
- Directs that r.patch run quietly, suppressing output of messages
on program progress to standard output.
- -z
- Use zero (0) for transparency instead of NULL.
Parameters:
- input=name,name,...
- The name(s) of between one and ten existing raster map layers to be patched
together. The first of the ten maps listed will be used as a base map,
and the second through tenth maps listed will be used to supply missing (zero)
category values for the first map.
- output=name
- The name of the new raster map to contain the resultant patched output.
EXAMPLE
Below, the raster map layer on the far left is patched
with the middle (patching) raster map layer,
to produce the composite raster map layer on the right.
1 1 1 0 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 1 2 2 0 0
1 1 0 2 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 2 2 2 0 0
3 3 3 3 2 2 0 0 0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0
3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 3 4 4 4 4
3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4
0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
Switching the patched and the patching raster map layers
produces the following results:
0 0 1 1 0 0 0 0 1 1 1 0 2 2 0 0 1 1 1 1 2 2 0 0
0 0 1 1 0 0 0 0 1 1 0 2 2 2 0 0 1 1 1 1 2 2 0 0
0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0 3 3 3 3 2 2 0 0
4 4 4 4 4 4 4 4 3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4
4 4 4 4 4 4 4 4 3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4
4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4
NOTES
Frequently, this program is used to patch together adjacent map
layers which have been digitized separately.
The programs
v.mkquads
and
v.mkgrid
can be used to make adjacent maps align neatly.
The user should check the current geographic region settings before running
r.patch, to ensure that the region boundaries encompass all
of the data desired to be included in the composite map.
Use of r.patch is generally followed by use of the GRASS programs
g.remove and
g.rename;
g.remove is used to remove
the original (un-patched) raster map layers,
while g.rename
is used to then assign to the newly-created
composite (patched) raster map layer the name of the original raster
map layer.
r.patch creates support files for the patched, composite output map.
SEE ALSO
g.region
g.remove
g.rename
r.mapcalc
r.support
v.mkgrid
v.mkquads
parser
AUTHOR
Michael Shapiro,
U.S. Army Construction Engineering
Research Laboratory
-z flag by Huidae Cho