cartagen.kmeans_selection

cartagen.kmeans_selection#

kmeans_selection(points, ratio, column)#

Reduce a set of points by selection using K-Means clustering.

For each K-Means cluster calculated depending on the ratio, the point with the largest value is selected.

For more information about K-Means clustering, here is a link to the related wikipedia article

Parameters:
  • points (GeoDataFrame of Point) – The points to reduce.

  • ratio (float) – A value between 0 (all points are removed) and 1 (all points are kept).

  • column (str) – Name of the column to use.

Returns:

points (GeoDataFrame of Point) – The provided set of points with two new attributes:

  • ’selected_kmeans’: Set to True if the point has been selected.

  • ’cluster_count’: The number of points in the K-Means cluster represented by this point.

See also

kmeans_simplification

Reduce a set of points by simplification using K-Means clustering.

kmeans_aggregation

Reduce a set of points by aggregation using K-Means clustering.

(Source code)

../_images/kmeans_selection.png