Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8, available here.
Updated manual page: here
Hence this command is useful for
Figure: Result of patching two raster maps containing NULLs using the default settings
The first name listed in the string input=name,name,name, ... 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 name maps will be used, in order, to supply data values for for the remaining "no data" cells.
Figure: Result of patching two raster maps using the -z flag to treat zeros as NULLs
The r.patch module iterates over all cells and for each cell of the output raster map uses the first corresponding non-NULL cell in the series of the input raster maps.
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
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
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 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 g.region program can be used:
g.region raster=map1[,map2[,...]]
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 reads the existing category label files and color tables from the input maps and creates these files for the patched, composite output map. This can be quite time consuming for certain maps, especially if there are many different category values across the patched maps. The -s flag allows disabling the reading and creation of these support files, meaning that the output map will have no category labels and no explicit color table.
Number of raster maps to be processed is given by the limit of the operating system. For example, both the hard and soft limits are typically 1024. The soft limit can be changed with e.g. ulimit -n 1500 (UNIX-based operating systems) but not higher than the hard limit. If it is too low, you can as superuser add an entry in
/etc/security/limits.conf # <domain> <type> <item> <value> your_username hard nofile 1500
Operating systems usually limit the length of the command line which limits the number of input raster maps user can pass to the module using the option input. In that case, r.series can be used instead of r.patch.
g.region raster=roads r.patch input=roads,water,forest output=result
MAPS=`g.list type=raster separator=comma pat="map_*"` g.region raster=$MAPS -p r.patch input=$MAPS output=maps_mosaic
Hints for large raster data processing
Last changed: $Date$
Available at: r.patch source code (history)
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8, available here.
Updated manual page: here
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
© 2003-2019 GRASS Development Team, GRASS GIS 7.4.5dev Reference Manual