[GRASS-SVN] r66136 - grass/trunk/vector/v.cluster
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Sep 6 15:43:02 PDT 2015
Author: wenzeslaus
Date: 2015-09-06 15:43:02 -0700 (Sun, 06 Sep 2015)
New Revision: 66136
Added:
grass/trunk/vector/v.cluster/v_cluster_4_methods.png
Modified:
grass/trunk/vector/v.cluster/v.cluster.html
Log:
v.cluster: add image to manual
make simple example primary, show how to display, add see also
Modified: grass/trunk/vector/v.cluster/v.cluster.html
===================================================================
--- grass/trunk/vector/v.cluster/v.cluster.html 2015-09-06 21:34:02 UTC (rev 66135)
+++ grass/trunk/vector/v.cluster/v.cluster.html 2015-09-06 22:43:02 UTC (rev 66136)
@@ -91,55 +91,113 @@
<i>urbanarea</i> (North Carolina sample dataset).
<p>
-10000 random points within the areas the vector urbanarea and within the
-subregion:
+First generate 1000 random points within the areas the vector urbanarea
+and within the subregion, then do clustering and visualize the result:
<div class="code"><pre>
# pick a subregion of the vector urbanarea
g.region -p n=272950 s=188330 w=574720 e=703090 res=10
-# create clustered points
-v.random output=rand_clust npoints=10000 restrict=urbanarea at PERMANENT
+# create random points in areas
+v.random output=random_points npoints=1000 restrict=urbanarea
# identify clusters
-v.cluster in=rand_clust out=rand_clusters method=dbscan
+v.cluster input=random_points output=clusters_optics method=optics
-# create colors for clusters
-v.db.addtable map=rand_clusters layer=2 columns="cat integer,grassrgb varchar(11)"
-v.colors map=rand_clusters layer=2 use=cat color=random rgb_column=grassrgb
+# set random vector color table for the clusters
+v.colors map=clusters_optics layer=2 use=cat color=random
-# display with your preferred method
+# display in command line
+d.mon wx0
+
+# note the second layer and transparent (none) color of the circle border
+d.vect map=clusters_optics layer=2 icon=basic/point size=10 color=none
</pre></div>
-<p>
-100 random points for each area in the vector urbanarea and within the
-subregion:
+<center>
+<img src="v_cluster_4_methods.png">
+<p><em>
+ Figure: Four different methods with default settings applied to
+ 1000 random points generated in the same way as in the example.
+</em></p>
+</center>
+
+<!--
+g.region -p n=272950 s=188330 w=574720 e=703090 res=10
+v.random output=rand_clust npoints=1000 restrict=urbanarea
+
+v.cluster in=rand_clust out=rand_clusters_dbscan method=dbscan
+v.colors map=rand_clusters_dbscan layer=2 use=cat color=random
+
+v.cluster in=rand_clust out=rand_clusters_dbscan2 method=dbscan2
+v.colors map=rand_clusters_dbscan2 layer=2 use=cat color=random
+
+v.cluster in=rand_clust out=rand_clusters_density method=density
+v.colors map=rand_clusters_density layer=2 use=cat color=random
+
+v.cluster in=rand_clust out=rand_clusters_optics2 method=optics2
+v.colors map=rand_clusters_optics2 layer=2 use=cat color=random
+
+v.cluster in=rand_clust out=rand_clusters_optics method=optics
+v.colors map=rand_clusters_optics layer=2 use=cat color=random
+
+# seems we have to remove first to avoid drawing into an old image
+rm v_cluster_4_methods.png
+
+d.mon cairo out=v_cluster_4_methods.png
+
+# the font doesn't work
+d.font "LiberationSans-Regular"
+
+d.frame frame=dbscan at=50,100,0,50 -c
+d.vect map=rand_clusters_dbscan layer=2 icon=basic/point size=10 color=none
+d.text text="dbscan" at=5,5 size=10 bgcolor=white
+
+d.frame frame=optics at=50,100,50,100 -c
+d.vect map=rand_clusters_optics layer=2 icon=basic/point size=10 color=none
+d.text text="optics" at=5,5 size=10 bgcolor=white
+
+d.frame frame=density at=0,50,0,50 -c
+d.vect map=rand_clusters_density layer=2 icon=basic/point size=10 color=none
+d.text text="density" at=5,5 size=10 bgcolor=white
+
+d.frame frame=optics2 at=0,50,50,100 -c
+d.vect map=rand_clusters_optics2 layer=2 icon=basic/point size=10 color=none
+d.text text="optics2" at=5,5 size=10 bgcolor=white
+
+d.mon stop=cairo
+-->
+
+Generate random points for analysis (100 points per area), use different
+method for clustering and visualize using color stored the attribute table.
<div class="code"><pre>
# pick a subregion of the vector urbanarea
g.region -p n=272950 s=188330 w=574720 e=703090 res=10
-# create 100 clustered points
-v.random output=rand_clust npoints=100 restrict=urbanarea at PERMANENT -a
+# create clustered points
+v.random output=rand_clust npoints=100 restrict=urbanarea -a
# identify clusters
-v.cluster input=rand_clust output=rand_clusters method=density
+v.cluster in=rand_clust out=rand_clusters method=dbscan
# create colors for clusters
-v.db.addtable map=rand_clusters layer=2 columns="cat integer"
-v.colors map=rand_clusters layer=2 use=cat color=random
+v.db.addtable map=rand_clusters layer=2 columns="cat integer,grassrgb varchar(11)"
+v.colors map=rand_clusters layer=2 use=cat color=random rgb_column=grassrgb
# display with your preferred method
-d.mon wx0
-# show clusters by color
-d.vect rand_clusters layer=2
+# remember to use the second layer and RGB column
+# for example use
+d.vect map=rand_clusters layer=2 color=none rgb_column=grassrgb icon=basic/circle
</pre></div>
<h2>SEE ALSO</h2>
<em>
-<a href="r.clump.html">r.clump</a>
+<a href="r.clump.html">r.clump</a>,
+<a href="v.hull.html">v.hull</a>,
+<a href="v.distance.html">v.distance</a>
</em>
<h2>AUTHOR</h2>
Added: grass/trunk/vector/v.cluster/v_cluster_4_methods.png
===================================================================
(Binary files differ)
Property changes on: grass/trunk/vector/v.cluster/v_cluster_4_methods.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
More information about the grass-commit
mailing list