Module Hub Beta

GEOCLUSTER

geoset radius unit min-points [namespace]

Density based spatial clustering with random sampling.

Creates a set of Geo Sets from geoset, each being a cluster.

radius is the maximum distance between near neighbors in the cluster, and min-points is a cluster’s minimum size.

The default cluster namespace is ‘DBRS’ – new geo cluster keys are created using the following syntax for their key names: namespace:{geoset}:....

More information about the algorithm: http://www.ucalgary.ca/wangx/files/wangx/dbrs.pdf

 

Return Value

Integer reply: the number of clusters created.

Examples

redis> GEOADD geoset 0 0 c1-1 0.01 0.01 c1-2 0.02 0.02 c1-3 0.01 0.02 c1-4 0.02 0.01 c1-5
(integer) 5
redis> GEOADD geoset 40 40 c2-1 40.01 40.01 c2-2 40.02 40.02 c2-3 40.1 40.02 c2-4 40.02 40.01 c2-5
(integer) 5
redis> GEOCLUSTER geoset 100 km 3
(integer) 2
redis> LRANGE DBRS:{geoset}:CL 0 -1
1) “DBRS:{g}:1”
2) “DBRS:{g}:2”
redis> ZRANGE DBRS:{geoset}:1 0 -1
1) “c1-1”
2) “c1-2”
3) “c1-5”
4) “c1-4”
5) “c1-3”
redis> ZRANGE DBRS:{geoset}:2 0 -1
1) “c2-1”
2) “c2-2”
3) “c2-5”
4) “c2-3”
5) “c2-4”

© 2017 Redis Labs, Inc. All rights reserved.