1v.cluster(1) Grass User's Manual v.cluster(1)
2
3
4
6 v.cluster - Performs cluster identification.
7
9 vector, point cloud, cluster, clump, level1
10
12 v.cluster
13 v.cluster --help
14 v.cluster [-2bt] input=name output=name [layer=string] [dis‐
15 tance=float] [min=integer] [method=string] [--overwrite]
16 [--help] [--verbose] [--quiet] [--ui]
17
18 Flags:
19 -2
20 Force 2D clustering
21
22 -b
23 Do not build topology
24 Advantageous when handling a large number of points
25
26 -t
27 Do not create attribute table
28
29 --overwrite
30 Allow output files to overwrite existing files
31
32 --help
33 Print usage summary
34
35 --verbose
36 Verbose module output
37
38 --quiet
39 Quiet module output
40
41 --ui
42 Force launching GUI dialog
43
44 Parameters:
45 input=name [required]
46 Name of input vector map
47 Or data source for direct OGR access
48
49 output=name [required]
50 Name for output vector map
51
52 layer=string
53 Layer number or name for cluster ids
54 Vector features can have category values in different layers. This
55 number determines which layer to use. When used with direct OGR
56 access this is the layer name.
57 Default: 2
58
59 distance=float
60 Maximum distance to neighbors
61
62 min=integer
63 Minimum number of points to create a cluster
64
65 method=string
66 Clustering method
67 Options: dbscan, dbscan2, density, optics, optics2
68 Default: dbscan
69
71 v.cluster partitions a point cloud into clusters or clumps.
72
73 If the minimum number of points is not specified with the min option,
74 the minimum number of points to constitute a cluster is number of
75 dimensions + 1, i.e. 3 for 2D points and 4 for 3D points.
76
77 If the maximum distance is not specified with the distance option, the
78 maximum distance is estimated from the observed distances to the neigh‐
79 bors using the upper 99% confidence interval.
80
81 v.cluster supports different methods for clustering. The recommended
82 methods are method=dbscan if all clusters should have a density (maxi‐
83 mum distance between points) not larger than distance or method=density
84 if clusters should be created separately for each observed density
85 (distance to the farthest neighbor).
86
87 dbscan
88 The Density-Based Spatial Clustering of Applications with Noise is a
89 commonly used clustering algorithm. A new cluster is started for a
90 point with at least min - 1 neighbors within the maximum distance.
91 These neighbors are added to the cluster. The cluster is then expanded
92 as long as at least min - 1 neighbors are within the maximum distance
93 for each point already in the cluster.
94
95 dbscan2
96 Similar to dbscan, but here it is sufficient if the resultant cluster
97 consists of at least min points, even if no point in the cluster has at
98 least min - 1 neighbors within distance.
99
100 density
101 This method creates clusters according to their point density. The max‐
102 imum distance is not used. Instead, the points are sorted ascending by
103 the distance to their farthest neighbor (core distance), inspecting min
104 - 1 neighbors. The densest cluster is created first, using as threshold
105 the core distance of the seed point. The cluster is expanded as for
106 DBSCAN, with the difference that each cluster has its own maximum dis‐
107 tance. This method can identify clusters with different densities and
108 can create nested clusters.
109
110 optics
111 This method is Ordering Points to Identify the Clustering Structure. It
112 is controlled by the number of neighbor points (option min - 1). The
113 core distance of a point is the distance to the farthest neighbor. The
114 reachability of a point q is its distance from a point p (original
115 optics: max(core-distance(p), distance(p, q))). The aim of the optics
116 method is to reduce the reachability of each point. Each unprocessed
117 point is the seed for a new cluster. Its neighbors are added to a queue
118 sorted by smallest reachability if their reachability can be reduced.
119 The points in the queue are processed and their unprocessed neighbors
120 are added to a queue sorted by smallest reachability if their reacha‐
121 bility can be reduced.
122
123 The optics method does not create clusters itself, but produces an
124 ordered list of the points together with their reachability. The output
125 list is ordered according to the order of processing: the first point
126 processed is the first in the list, the last point processed is the
127 last in the list. Clusters can be extracted from this list by identify‐
128 ing valleys in the points’ reachability, e.g. by using a threshold
129 value. If a maximum distance is specified, this is used to identify
130 clusters, otherwise each separated network will constitute a cluster.
131
132 The OPTICS algorithm uses each yet unprocessed point to start a new
133 cluster. The order of the input points is arbitrary and can thus influ‐
134 ence the resultant clusters.
135
136 optics2
137 EXPERIMENTAL This method is similar to OPTICS, minimizing the reacha‐
138 bility of each point. Points are reconnected if their reachability can
139 be reduced. Contrary to OPTICS, a cluster’s seed is not fixed but
140 changed if possible. Each point is connected to another point until the
141 core of the cluster (seed point) is reached. Effectively, the initial
142 seed is updated in the process. Thus separated networks of points are
143 created, with each network representing a cluster. The maximum distance
144 is not used.
145
147 Analysis of random points for areas in areas of the vector urbanarea
148 (North Carolina sample dataset).
149
150 First generate 1000 random points within the areas the vector urbanarea
151 and within the subregion, then do clustering and visualize the result:
152 # pick a subregion of the vector urbanarea
153 g.region -p n=272950 s=188330 w=574720 e=703090 res=10
154 # create random points in areas
155 v.random output=random_points npoints=1000 restrict=urbanarea
156 # identify clusters
157 v.cluster input=random_points output=clusters_optics method=optics
158 # set random vector color table for the clusters
159 v.colors map=clusters_optics layer=2 use=cat color=random
160 # display in command line
161 d.mon wx0
162 # note the second layer and transparent (none) color of the circle border
163 d.vect map=clusters_optics layer=2 icon=basic/point size=10 color=none
164
165 Figure: Four different methods with default settings applied to 1000
166 random points generated in the same way as in the example. Generate
167 random points for analysis (100 points per area), use different method
168 for clustering and visualize using color stored the attribute table.
169 # pick a subregion of the vector urbanarea
170 g.region -p n=272950 s=188330 w=574720 e=703090 res=10
171 # create clustered points
172 v.random output=rand_clust npoints=100 restrict=urbanarea -a
173 # identify clusters
174 v.cluster in=rand_clust out=rand_clusters method=dbscan
175 # create colors for clusters
176 v.db.addtable map=rand_clusters layer=2 columns="cat integer,grassrgb varchar(11)"
177 v.colors map=rand_clusters layer=2 use=cat color=random rgb_column=grassrgb
178 # display with your preferred method
179 # remember to use the second layer and RGB column
180 # for example use
181 d.vect map=rand_clusters layer=2 color=none rgb_column=grassrgb icon=basic/circle
182
184 r.clump, v.hull, v.distance
185
187 Markus Metz
188
189 Last changed: $Date: 2015-09-07 10:09:13 +0200 (Mon, 07 Sep 2015) $
190
192 Available at: v.cluster source code (history)
193
194 Main index | Vector index | Topics index | Keywords index | Graphical
195 index | Full index
196
197 © 2003-2019 GRASS Development Team, GRASS GIS 7.4.4 Reference Manual
198
199
200
201GRASS 7.4.4 v.cluster(1)