Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here
v.random can generate also 3D vector points or write random value to attribute table. Point height range or attribute value range is controlled by specifying zmin and zmax values. Both z values are included in range (zmin <= z <= zmax). Generated random attribute value type can be controlled by column data type. Use INTEGER column type for integers and DOUBLE PRECISION for floating point numbers. Integer values are calculated by rounding random floating point number.
To produce repeatable results a random seed can be set using the option seed.
If an input vector map with areas is specified, the location of random points is restricted to the selected areas. By default, the requested number of points are distributed across all areas.
If the -a flag is given, the requested number of points is generated for each individual area. For example, if 20 points should be generated and the input map has 100 individual areas, 2000 points will be generated in total.
v.random output=binary_random npoints=20 zmin=0 zmax=1 column='binary' v.db.select binary_random cat|binary 1|0.63495 2|0.233421 3|0.489302 4|0.748264 5|0.505556 6|0.32975 [...] v.univar -d binary_random Calculating geometric distances between 20 primitives... [...] minimum: 148.515 maximum: 16572.8 [...]
v.random output=binary_random npoints=20 zmin=0 zmax=1 column='binary' column_type=integer v.db.select binary_random cat|binary 1|0 2|0 3|0 4|0 5|1 6|0 [...]
v.random seed=52 output=height_random npoints=40 zmin=110 zmax=170 -z v.univar -d height_random Calculating geometric distances between 40 primitives... [...] minimum: 334.889 maximum: 18351.9 range: 18017 sum: 5.38425e+06 mean: 7266.2 mean of absolute values: 7266.2 population standard deviation: 3563.95 [...] skewness: 0.34703
g.region -p raster=elevation v.random output=random_samples npoints=20 v.db.addtable map=random_samples columns='cat INTEGER, sample DOUBLE PRECISION' v.what.rast map=random_samples raster=elevation column=sample v.db.select random_samples cat|sample 1|103.9935 2|129.1266 3|96.01388 [...]
g.region -p vector=geology v.random output=random_samples npoints=20 v.db.addtable map=random_samples columns='cat integer, geology varchar(100)' v.what.vect map=random_samples column=geology \ query_map=geology query_layer=1 query_column=GEO_NAME v.db.select random_samples cat|geology 1|PzZm 2| 3|Zatm [...]
g.region -p raster=landclass96 r.to.vect -v input=landclass96 output=landclass96 type=area v.random restrict=landclass96 output=random_samples npoints=20 \ where="label = 'forest'" layer=1
g.region -p raster=landclass96 r.to.vect -v input=landclass96 output=landclass96 type=area v.random restrict=landclass96 output=random_samples npoints=2 \ where="label = 'water'" layer=1 -a
Last changed: $Date: 2016-08-30 06:30:47 -0700 (Tue, 30 Aug 2016) $
Available at: v.random source code (history)
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4, available here.
Updated manual page: here
Main index | Vector index | Topics index | Keywords index | Full index
© 2003-2018 GRASS Development Team, GRASS GIS 7.0.7svn Reference Manual