cartagen.quadtree_aggregation

cartagen.quadtree_aggregation#

quadtree_aggregation(points, depth, column=None, quadtree=False)#

Reduce a set of points by aggregation using a quadtree.

For each quadtree cell, the centroid is calculated.

This algorithm was proposed by Bereuter & Weibel. [1] The quadtree algorithm iteratively divide the point set into four chunks, creating clusters, until the depth parameter is reach or only one point remain per cluster.

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

  • depth (int) – The maximum depth of the quadtree. This acts as a selector for the wanted degree of generalisation. The lower the value, the more generalised the point set will be.

  • column (str, optional) – Name of a numeric column to calculate the sum and mean.

  • quadtree (bool, optional) – If set to True, returns a tuple with the reduced points and the quadtree.

Returns:

  • points (GeoDataFrame of Point) – A new set of points representing the centroids with:

    • ’cell_count’: The number of points in the quadtree cell represented by this point.

    • ’column_total’: The sum of the column values if provided.

    • ’column_mean’: The mean of the column values if provided.

  • quadtree (QuadTree, optional)

See also

quadtree_selection

Reduce a set of points by selection using a quadtree.

quadtree_simplification

Reduce a set of points by simplification using a quadtree.

References

(Source code)

../_images/quadtree_aggregation.png