r.patch.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. <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>
  34. Switching the <em>patched</em> and the <em>patching</em> raster map layers
  35. produces the following results:
  36. <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>
  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 rast=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><em>r.patch</em> creates support files for the patched, composite output map.
  67. <h2>EXAMPLE</h2>
  68. Create a list of maps matching a pattern, extend the region to include them
  69. all, and patch them together to create a mosaic. Overlapping maps will be
  70. used in the order listed.
  71. <div class="code"><pre>
  72. MAPS=`g.mlist type=rast sep=, pat="map_*"`
  73. g.region rast=$MAPS
  74. r.patch in=$MAPS out=mosaic
  75. </pre></div>
  76. <br>
  77. <h2>SEE ALSO</h2>
  78. <em><a href="g.region.html">g.region</a></em>,
  79. <em><a href="g.remove.html">g.remove</a></em>,
  80. <em><a href="g.rename.html">g.rename</a></em>,
  81. <em><a href="r.mapcalc.html">r.mapcalc</a></em>,
  82. <em><a href="r.support.html">r.support</a></em>,
  83. <em><a href="v.mkgrid.html">v.mkgrid</a></em>
  84. <h2>AUTHOR</h2>
  85. Michael Shapiro,
  86. U.S. Army Construction Engineering Research Laboratory
  87. <br>
  88. -z flag by Huidae Cho
  89. <p><i>Last changed: $Date$</i>