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 (
GeoDataFrameofPoint) – 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 (
GeoDataFrameofPoint) – 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 (
GeoDataFrameofPolygon, optional)
See also
labelgrid_selectionReduce a set of points by selection using the Label Grid method.
labelgrid_simplificationReduce a set of points by simplification using the Label Grid method.
References