Provided by: grass-doc_7.8.7-1_all bug

NAME

       r.random  - Creates a raster map layer and vector point map containing randomly located points.

KEYWORDS

       raster, sampling, vector, random, level1

SYNOPSIS

       r.random
       r.random --help
       r.random    [-zidb]    input=name    [cover=name]    npoints=number[%]    [raster=name]     [vector=name]
       [seed=integer]   [--overwrite]  [--help]  [--verbose]  [--quiet]  [--ui]

   Flags:
       -z
           Generate points also for NULL category

       -i
           Report information about input raster and exit

       -d
           Generate vector points as 3D points

       -b
           Do not build topology
           Do not build topology in points mode

       --overwrite
           Allow output files to overwrite existing files

       --help
           Print usage summary

       --verbose
           Verbose module output

       --quiet
           Quiet module output

       --ui
           Force launching GUI dialog

   Parameters:
       input=name [required]
           Name of input raster map

       cover=name
           Name of cover raster map

       npoints=number[%] [required]
           The number of points to allocate

       raster=name
           Name for output raster map

       vector=name
           Name for output vector map

       seed=integer
           Seed for rand() function

DESCRIPTION

       The program r.random allows the user to create a raster map layer and/or a vector points  map  containing
       coordinates  of points whose locations have been randomly determined.  The program locates these randomly
       generated vector points (sites) within the current geographic region  and  mask  (if  any),  on  non-NULL
       category  value data areas within a user-specified raster map layer. If the user sets the -z flag, points
       will be randomly generated across all cells (even those with NULL values).

       The category values and corresponding category names already associated with the random  point  locations
       in  the  input  map  layer  are  assigned  to  these  points in the raster_output map layer. If the -z is
       specified, then a unique entry is made for the value used where the input was NULL.   This  value  is  at
       least 1 less than the smallest value in the input raster and is given a medium gray color.

NOTES

       If  a  cover  raster  map is specified and the cover map contains NULL (no data) values, these points are
       suppressed in the resulting vector_output or raster_output map.

       The vector_output file created by r.random contains vector points that represent the center points of the
       randomly generated cells.  A value attribute contains the cell value of the input raster (or the assigned
       value when -z is used).
       If a cover map is additionally specified, a second column  covervalue is  populated  with  raster  values
       from the cover map.

       If  the  user  sets  the  -b  flag,  vector  points are written without topology to minimize the required
       resources. This is suitable input to v.surf.rst and other vector modules.

       The user may specify the quantity of random locations to be generated either as a positive integer (e.g.,
       10), or as a percentage of the raster map layer’s cells (e.g., 10%,  or  3.05%).   The  number  of  cells
       considered  for  the  percentage  reflects  whether  or  not  the  -z  flag was given. Options are 0-100;
       percentages less than one percent may be stated as decimals.

       Flag -i prints the raster map’s name and location, the total number of cells  under  the  current  region
       settings,  and  the  number  of  NULL  valued cells under the current region settings.  Then module exits
       without doing anything.  Useful for deciding on the number of sites to have  r.random  create.   WARNING:
       this feature may be removed in future. Use g.region and r.report instead.
       g.region -p
       r.report map=inputmap units=c null="*" nsteps=1

       To create random vector point locations within some, but not all, non-zero categories of the input raster
       map  layer,  the  user must first create a reclassified raster map layer of the original raster map layer
       (e.g., using the GRASS program r.reclass) that contains only the desired categories,  and  then  use  the
       reclassed raster map layer as input to r.random.

EXAMPLES

   Random 2D vector elevation points
       Random  vector  elevation  points sampled from elevation map in the North Carolina sample dataset region,
       result stored in 2D vector map:
       g.region raster=elevation -p
       r.random elevation vector=elevrand n=100
       v.db.select elevrand
       v.univar elevrand col=value type=point

   Random 3D vector elevation points
       Random vector elevation points sampled from elevation map in the North  Carolina  sample  dataset  region
       with collocated values sampled from landuse map, result stored in 3D vector map:
       g.region raster=elevation -p
       r.random -d elevation cover=landclass96 vector=luserand3d n=100
       # data output (value: elevation, covervalue: landuse class):
       v.db.select luserand3d
       cat|value|covervalue
       1|111.229591|5
       2|71.093758|1
       3|122.51075|5
       4|146.17395|4
       ...

KNOWN ISSUES

       It’s not possible to use the -i flag without specifying the npoints parameter.

SEE ALSO

        g.region, r.reclass, v.random, v.surf.rst

AUTHOR

       Dr. James Hinthorne, GIS Laboratory, Central Washington University

       Modified for GRASS 5.0 by Eric G. Miller

       Cover map support by Markus Neteler, 2007

SOURCE CODE

       Available at: r.random source code (history)

       Accessed: unknown

       Main index | Raster index | Topics index | Keywords index | Graphical index | Full index

       © 2003-2022 GRASS Development Team, GRASS GIS 7.8.7 Reference Manual

GRASS 7.8.7                                                                                     r.random(1grass)