[GRASS-SVN] r69345 - grass/trunk/vector/v.random
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 2 09:13:57 PDT 2016
Author: neteler
Date: 2016-09-02 09:13:56 -0700 (Fri, 02 Sep 2016)
New Revision: 69345
Added:
grass/trunk/vector/v.random/vrandom_polygons.png
Modified:
grass/trunk/vector/v.random/v.random.html
Log:
v.random manual: random adjacent polygons example added
Modified: grass/trunk/vector/v.random/v.random.html
===================================================================
--- grass/trunk/vector/v.random/v.random.html 2016-09-02 13:46:40 UTC (rev 69344)
+++ grass/trunk/vector/v.random/v.random.html 2016-09-02 16:13:56 UTC (rev 69345)
@@ -57,7 +57,8 @@
Generate 20 random points with binary attributes (only 0 or 1):
<div class="code"><pre>
-v.random output=binary_random npoints=20 zmin=0 zmax=1 column='binary' column_type=integer
+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
@@ -102,6 +103,45 @@
Random points with different X, Y, and Z coordinates
</center>
+
+<h3>Generating random adjacent polygons</h3>
+
+To generate random adjacent polygons, first the centroids are generated as
+points, then a triangulation is run (North Carolina sample dataset:
+
+<div class="code"><pre>
+g.region vector=nc_state
+v.random output=randpoints6k npoints=6000
+v.voronoi input=randpoints6k output=randareas6k
+v.info -t randareas6k
+v.category randareas6k option=print
+
+# plot vector polygons
+d.mon wx0
+d.vect randareas6k -c
+</pre></div>
+<p>
+<center>
+<img src="vrandom_polygons.png" border=1><br>
+Random adjacent polygons from random points (here: used as centroids)
+</center>
+
+<p>
+To eventually obtain isolated polygons, selected polygons can be extracted with
+<em>v.extract</em>.
+<p>
+
+These vector polygons can also be rasterized:
+<div class="code"><pre>
+# rasterize polygons
+# note: rastermaps must result in at least 6k pixel in this example
+g.region vector=nc_state res=500 -p -a
+v.to.rast randareas6k out=randareas6k use=cat
+r.colors randareas6k color=random
+d.rast randareas6k
+</pre></div>
+
+
<h3>Random sampling from raster map</h3>
Generate 20 random samples from a raster map:
Added: grass/trunk/vector/v.random/vrandom_polygons.png
===================================================================
(Binary files differ)
Property changes on: grass/trunk/vector/v.random/vrandom_polygons.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
More information about the grass-commit
mailing list