cartagen.labelgrid_aggregation

cartagen.labelgrid_aggregation#

labelgrid_aggregation(points, width, height, column=None, shape='square', grid=False)#

Reduce a set of points by aggregation using the Label Grid method.

For each cell of the given shape, the point closest to the grid’s centroid is selected.

This algorithm was proposed by Gröbe & Burghardt. [1] It assigns each point to a grid cell of a given height, width and shape before reducing the points for each cell.

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

  • width (float) – Width of the grid cells.

  • height (float) – Height of the grid cells.

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

  • shape (str, optional) – Shape of the grid cells, can be ‘square’, ‘diamond’, ‘hexagonal’.

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

Returns:

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

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

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

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

  • grid (GeoDataFrame of Polygon, optional)

See also

labelgrid_selection

Reduce a set of points by selection using the Label Grid method.

labelgrid_simplification

Reduce a set of points by simplification using the Label Grid method.

References

(Source code)

../_images/labelgrid_aggregation.png