r.patch.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <h2>DESCRIPTION</h2>
  2. The GRASS program <em>r.patch</em> allows the user to build a new
  3. raster map the size and resolution of the current region by assigning
  4. known data values from input raster maps to the cells in this region.
  5. This is done by filling in "no data" cells, those that do not yet
  6. contain data, contain NULL data, or, optionally contain 0 data,
  7. with the data from the first input map.
  8. Once this is done the remaining holes are filled in by the next input map,
  9. and so on.
  10. This program
  11. is useful for making a composite raster map layer from two or more adjacent
  12. map layers, for filling in "holes" in a raster map layer's data (e.g., in
  13. digital elevation data), or for updating an older map layer with more recent
  14. data. The current geographic region definition and mask settings are
  15. respected.
  16. <p>The first <em>name</em> listed in the string
  17. <b>input=</b><em>name</em>,<em>name</em>,<em>name</em>, ... is the name of
  18. the first map whose data values will be used to fill in "no data" cells
  19. in the current region. The second through last input <em>name</em>
  20. maps will be used, in order, to supply data values for for the remaining
  21. "no data" cells.
  22. <h2>EXAMPLE</h2>
  23. Below, the raster map layer on the far left is <b>patched</b>
  24. with the middle (<em>patching</em>) raster map layer,
  25. to produce the <em>composite</em> raster map layer on the right.
  26. <div class="code"><pre>
  27. 1 1 1 0 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 1 2 2 0 0
  28. 1 1 0 2 2 2 0 0 0 0 1 1 0 0 0 0 1 1 1 2 2 2 0 0
  29. 3 3 3 3 2 2 0 0 0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0
  30. 3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 3 4 4 4 4
  31. 3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4 3 3 3 4 4 4 4 4
  32. 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
  33. </pre></div>
  34. Switching the <em>patched</em> and the <em>patching</em> raster map layers
  35. produces the following results:
  36. <div class="code"><pre>
  37. 0 0 1 1 0 0 0 0 1 1 1 0 2 2 0 0 1 1 1 1 2 2 0 0
  38. 0 0 1 1 0 0 0 0 1 1 0 2 2 2 0 0 1 1 1 1 2 2 0 0
  39. 0 0 0 0 0 0 0 0 3 3 3 3 2 2 0 0 3 3 3 3 2 2 0 0
  40. 4 4 4 4 4 4 4 4 3 3 3 3 0 0 0 0 4 4 4 4 4 4 4 4
  41. 4 4 4 4 4 4 4 4 3 3 3 0 0 0 0 0 4 4 4 4 4 4 4 4
  42. 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4
  43. </pre></div>
  44. <h2>NOTES</h2>
  45. Frequently, this program is used to patch together adjacent map layers which
  46. have been digitized separately. The program
  47. <em><a href="v.mkgrid.html">v.mkgrid</a></em> can be used to make adjacent
  48. maps align neatly.
  49. <p>The user should check the current geographic region settings before running
  50. <em>r.patch</em>, to ensure that the region boundaries encompass all
  51. of the data desired to be included in the composite map and to ensure that the
  52. region resolution is the resolution of the desired data. To set the
  53. geographic region settings to one or several raster maps, the <em>g.region</em>
  54. program can be used:
  55. <div class="code"><pre>
  56. g.region raster=map1[,map2[,...]]
  57. </pre></div>
  58. <p>
  59. Use of <em>r.patch</em> is generally followed by use of the GRASS programs
  60. <em><a href="g.remove.html">g.remove</a></em> and
  61. <em><a href="g.rename.html">g.rename</a></em>;
  62. <em>g.remove</em> is used to remove the original (un-patched) raster map
  63. layers, while <em>g.rename</em> is used to then assign to the newly-created
  64. composite (patched) raster map layer the name of the original raster map
  65. layer.
  66. <p>
  67. <em>r.patch</em> creates support files for the patched, composite output map.
  68. <p>
  69. Number of raster maps to be processed is given by the limit of the
  70. operating system. For example, both the hard and soft limits are
  71. typically 1024. The soft limit can be changed with e.g. <tt>ulimit -n
  72. 1500</tt> (UNIX-based operating systems) but not higher than the hard
  73. limit. If it is too low, you can as superuser add an entry in
  74. <div class="code"><pre>
  75. /etc/security/limits.conf
  76. # &lt;domain&gt; &lt;type&gt; &lt;item&gt; &lt;value&gt;
  77. your_username hard nofile 1500
  78. </pre></div>
  79. This would raise the hard limit to 1500 file. Be warned that more
  80. files open need more RAM. See also the Wiki page
  81. <a href="http://grasswiki.osgeo.org/wiki/Large_raster_data_processing">Hints for large raster data processing</a>.
  82. <h2>EXAMPLE</h2>
  83. Create a list of maps matching a pattern, extend the region to include them
  84. all, and patch them together to create a mosaic. Overlapping maps will be
  85. used in the order listed.
  86. <div class="code"><pre>
  87. MAPS=`g.list type=rast sep=, pat="map_*"`
  88. g.region raster=$MAPS
  89. r.patch in=$MAPS out=mosaic
  90. </pre></div>
  91. <br>
  92. <h2>SEE ALSO</h2>
  93. <em>
  94. <a href="g.region.html">g.region</a>,
  95. <a href="g.remove.html">g.remove</a>,
  96. <a href="g.rename.html">g.rename</a>,
  97. <a href="r.mapcalc.html">r.mapcalc</a>,
  98. <a href="r.support.html">r.support</a>,
  99. <a href="v.mkgrid.html">v.mkgrid</a>
  100. </em>
  101. <p>
  102. <a href="http://grasswiki.osgeo.org/wiki/Large_raster_data_processing">Hints for large raster data processing</a>
  103. <h2>AUTHOR</h2>
  104. Michael Shapiro,
  105. U.S. Army Construction Engineering Research Laboratory
  106. <br>
  107. -z flag and performance improvement by Huidae Cho
  108. <p><i>Last changed: $Date$</i>