# `Macaw.Frame.Coordinates.Geographic`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/coordinates/geographic.ex#L1)

The geographic model (spec/03 §8): a projection and a view. It owns no position scales:
positions come from the `projection` spatial step, which reads the model's projection
through its context. It owns `color` and any other non-position scale.

- **What it owns** (§8.1): `projection` (`type`, required, one of
  `Macaw.Draw.Geo.Projection`'s types; `scale`, `translate`, `center`, `rotate`,
  `parallels`, `clip_angle`; `translate` the plot's center by default) and `fit`.
- **Clipping is the view's** (§8.2): a row the projection clips keeps its place with
  `nil` positions, so inference and the summary read every row.
- **The fit** (§8.3): `scale` and `translate` set to the plot inset by `padding` over
  the points of a slot's rows before any step, by `fields` (`[longitude, latitude]`) or
  `field` (a GeoJSON geometry), `min_span` meters widening coincident points; re-run on
  every delivery to the slot and on `size`.
- **The view and the box window** (§8.4): the option `view:` (a box, the Frame's bound
  state) is the view a realization shows; a finished pan or zoom emits `"view"` with the
  box enclosing the plot's corners and edge midpoints inverted through the projection;
  it writes `window` only over a `:point` window field; a view of empty space emits
  nothing.
- **Tiles alignment** (§8.5): a `tiles` layer needs a Mercator, `center` latitude 0,
  no tilt or roll, else `{:tiles, :projection, what}` at the layer's `kind`.
- **Hit-testing, writes and summary** (§8.6): `invert/2` through the projection's
  inverse, `data-mw-projection` for the client (`attrs/1`), the summary "map" with the
  view's box.

Copied from visualize's `Visualize.Chart.Frame` (`:geo`) over `Macaw.Draw.Geo.Projection`
and `Macaw.Draw.Geo.Tiles`.

# `attrs`

```elixir
@spec attrs(term()) :: %{required(String.t()) =&gt; String.t()}
```

The projection's parameters as the client reads them (§8.6): `data-mw-projection`, its
type and numbers, `type,scale,tx,ty,cx,cy,λ,φ,γ,clip,p1,p2` (`clip` `-` for none).

# `box`

```elixir
@spec box(term(), term()) :: {:ok, map()} | :none
```

The box a view shows (§8.4): the plot's four corners and its edge midpoints inverted
through the projection, the box `%{west, south, east, north}` enclosing them, latitudes
clamped to ±90 and `west` east of `east` when it crosses the antimeridian. When a corner
or midpoint is off the sphere it contributes nothing, and the box is the finer sample of
`Macaw.Draw.Geo.Viewport.box/2`, which finds a globe smaller than the plot; `:none` when
nothing of the sphere is in view.

# `gesture`

A finished pan or zoom (§8.4): the gesture's `scale` and `translate`, the moved view,
set on the model's projection; the `"view"` event's box is that view's.

---

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