## 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.

## SYNOPSIS

r.patch
r.patch help
r.patch [-qz] input=string[,string,...] output=string

### Flags:

-q
  Quiet
-z
  Use zero (0) for transparency instead of NULL

### Parameters:

input=string[,string,...]
  Name of raster maps to be patched together
output=string
  Name of the result map

## 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 current geographic region definition and mask settings are respected.

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 200 (max) 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, ...

## 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

Last changed: $Date: 2003/05/06 14:44:48 $

Help Index