clustering
This module contains functions that perform clustering on geographies.
ST_CLUSTERKMEANS
Description
Takes a set of points as input and partitions them into clusters using the k-means algorithm. Returns an array of tuples with the cluster index for each of the input features and the input geometry.
geojsons
:ARRAY
points to be clustered.numberOfClusters
(optional):INT
numberOfClusters that will be generated. By defaultnumberOfClusters
isMath.sqrt(<NUMBER OF POINTS>/2)
. The output number of cluster cannot be greater to the number of distinct points of thegeojsons
.
Return type
ARRAY
: containing objects with cluster
, as the cluster id, and geom
, as the geometry geojson.
Examples
Additional examples
Last updated