r.random.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <h2>DESCRIPTION</h2>
  2. <p>The program <em>r.random</em> allows the user to create a
  3. raster map layer and/or a vector points map containing
  4. coordinates of points whose locations have been randomly
  5. determined. The program locates these randomly generated
  6. vector points (sites) within the current geographic region and mask (if
  7. any), on non-NULL category value data areas within a
  8. user-specified raster map layer. If the user sets the
  9. <b>-z</b> flag, points will be randomly generated across all
  10. cells (even those with NULL values).
  11. <p>The category values and
  12. corresponding category names already associated with the
  13. random point locations in the <em>input</em> map layer are
  14. assigned to these points in the <em>raster_output</em> map
  15. layer. If the <b>-z</b> is specified, then a unique entry
  16. is made for the value used where the <em>input</em> was NULL.
  17. This value is at least 1 less than the smallest value in the
  18. <em>input</em> raster and is given a medium gray color.
  19. <h2>NOTES</h2>
  20. <p>If a <em>cover</em> raster map is specified and the <em>cover</em> map
  21. contains NULL (no data) values, these points are suppressed in the
  22. resulting <em>vector_output</em> or <em>raster_output</em> map.
  23. <p>The <em>vector_output</em> file created by <em>r.random</em>
  24. contains vector points that represent the <em>center points</em> of the
  25. randomly generated cells. A <em>value</em> attribute contains the cell value
  26. of the <em>input</em> raster (or the assigned value
  27. when <b>-z</b> is used). <br>
  28. If a <em>cover</em> map is additionally specified, a second
  29. column <em>covervalue</em> is populated with raster values from
  30. the <em>cover</em> map.
  31. <p>If the user sets the <b>-b</b> flag, vector points are written without
  32. topology to minimize the required resources. This is suitable input
  33. to <em>v.surf.rst</em> and other vector modules.
  34. <p>The user may specify the quantity of random locations to be
  35. generated either as a <em>positive integer</em> (e.g., 10),
  36. or as a <em>percentage of the raster map layer's cells</em>
  37. (e.g., 10%, or 3.05%). The number of cells considered for
  38. the percentage reflects whether or not the <b>-z</b> flag
  39. was given. Options are 0-100; percentages less than
  40. one percent may be stated as decimals.
  41. <p>Flag <b>-i</b> prints the raster map's name and location,
  42. the total number of cells under the current region settings, and
  43. the number of NULL valued cells under the current region settings.
  44. Then module exits without doing anything. Useful for deciding on the number
  45. of sites to have <em>r.random</em> create.
  46. <b>WARNING:</b> this feature may be removed in future. Use
  47. <a href="g.region.html">g.region</a> and
  48. <a href="r.report.html">r.report</a>
  49. instead.
  50. <div class="code"><pre>
  51. g.region -p
  52. r.report map=inputmap units=c null=* nsteps=1
  53. </pre></div>
  54. <p>To create random vector point locations within some, but not all,
  55. non-zero categories of the input raster map layer,
  56. the user must first create a reclassified raster map layer
  57. of the original raster map layer (e.g., using the GRASS
  58. program <em><a href="r.reclass.html">r.reclass</a></em>)
  59. that contains only the desired categories,
  60. and then use the reclassed raster map layer as input to <em>r.random</em>.
  61. <h2>EXAMPLES</h2>
  62. <p>Random vector elevation points sampled from elevation map in the
  63. Spearfish region, result stored in 2D vector map:
  64. <div class="code"><pre>
  65. g.region raster=elevation.10m -p
  66. r.random elevation.10m vector=elevrand n=100
  67. v.db.select elevrand
  68. v.univar elevrand col=value type=point
  69. </pre></div>
  70. <p>Random vector elevation points sampled from elevation map in the
  71. Spearfish region with collocated values sampled from landuse map,
  72. result stored in 3D vector map:
  73. <div class="code"><pre>
  74. g.region raster=elevation.10m -p
  75. r.random -d elevation.10m cover=landcover.30m vector=luserand3d n=100
  76. # data output (value: elevation, covervalue: landuse class):
  77. v.db.select luserand3d
  78. cat|value|covervalue
  79. 1|1151.406616|81
  80. 2|1172.121216|71
  81. 3|1183.219604|71
  82. ...
  83. </pre></div>
  84. <h2>KNOWN ISSUES</h2>
  85. It's not possible to use the <b>-i</b> flag and not also specify the <b>n</b>
  86. parameter.
  87. <h2>SEE ALSO</h2>
  88. <em>
  89. <a href="g.region.html">g.region</a><br>
  90. <a href="r.reclass.html">r.reclass</a><br>
  91. <a href="v.random.html">v.random</a><br>
  92. <a href="v.surf.rst.html">v.surf.rst</a>
  93. </em>
  94. <h2>AUTHOR</h2>
  95. Dr. James Hinthorne,
  96. GIS Laboratory,
  97. Central Washington University
  98. <p>Modified for GRASS 5.0 by Eric G. Miller
  99. <p>Cover map support by Markus Neteler, 2007
  100. <p><i>Last changed: $Date$</i>