r.patch.html 5.1 KB

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