cartagen.kmeans_simplification

cartagen.kmeans_simplification#

kmeans_simplification(points, ratio)#

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

For each K-Means cluster calculated depending on the ratio, the point closest to the cluster’s centroid 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).

Returns:

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

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

See also

kmeans_selection

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

kmeans_aggregation

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

(Source code)

../_images/kmeans_simplification.png