# `Macaw.Frame.Transforms.PointCluster`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/transforms/point_cluster.ex#L1)

The `point_cluster` step (spec/04 §5.3, §7.1): a map's marker clustering, points in
pixels grouped within `radius` (`40`) by a grid-and-merge pass at the view's zoom. It is
the spec's `cluster` step for points, named apart from the hierarchy's `cluster`
(`Macaw.Frame.Transforms.Cluster`) so the two share one registry, as `density_2d` is
named apart from `macaw_data`'s `density`.

It reads the pixel points `fields: [x, y]` (`["x", "y"]` by default: a `projection`
step's output), dropping a `nil` or non-numeric one. **Grid:** each point falls in the
square cell of side `radius` holding it. **Merge:** cells are visited in the order their
first point appears, and each joins the first cluster, in the order the clusters were
made, whose center lies within `radius` of the cell's center and whose own first cell
is the cell's or one of its eight neighbors; else it starts a cluster. A center is the
mean of its points. The step answers one row per cluster, in the order made: `x`, `y`
(its center), `count` and `members`, the identities of its points in row order: the
`id` field's readings, else the rows' indexes.

It needs the frame and the projection (`needs: [:frame, :projection]`), so it re-runs
whenever the view changes: a zoom changes the points' pixels and the projection with
them, and the pipeline keys the step by both (spec/04 §7.3).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
