# `Macaw.Frame.Layers.Tiles`
[🔗](https://github.com/dcoai/macaw_frame/blob/v0.1.0/lib/macaw/frame/layers/tiles.ex#L1)

The `tiles` kind (spec/04 §4.16), copied from visualize's `Visualize.Chart.Mark.Tiles`:
a basemap of raster tiles beneath every other layer.

Channels: none. Rows: none (`data` not required). Models: `[:geographic]`, tile-aligned
(spec/03). Order: `:beneath`. Targets: `[:svg]`. Key of its own: `tiles`, a node of `url`
(required: the provider's template with `{z}`, `{x}`, `{y}` and optionally `{s}`),
`attribution` (required, text), `subdomains` (`["a", "b", "c"]`) and `max_zoom` (`19`).

**Tiles go through the proxy.** `assets/1` declares a proxy route for the template,
`%{name: "tiles", url: <url>, types: ["image/png", "image/jpeg", "image/webp"]}`, and an
image's `href` is the route's same-origin path for the tile (`path/2`, or the Frame's own
through the layer context's `proxy`), never the provider's URL. Two `tiles` layers with
different templates declare `"tiles"` and `"tiles-2"`, in document order (the context's
`route`).

**Drawing**: from the model's projection, the covering tiles of `Macaw.Draw.Geo.Tiles`,
one image per tile, row then column, then the attribution in the plot's bottom-right
corner (`x: width − 4`, `y: height − 4`, `text-anchor` `end`, `class="mw-attribution"`) in
the layer's style over the `label` style, the whole clipped to the plot. The library never
fetches a tile. Budget: `nil`. Auxiliary. Legend: none.

# `keys`

```elixir
@spec keys() :: [map()]
```

The kind's own key of the layer node: `tiles` (spec/02 §5.3).

# `path`

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

A tile's same-origin proxy path for a route (§4.16): `/macaw/proxy/<route>` with the
tile's address values as its query, in name order. A Frame mounted with macaw_component
passes its own (`Macaw.Component.Proxy.path/3`) as the layer context's `proxy`.

    iex> Macaw.Frame.Layers.Tiles.path("tiles", %{"z" => "2", "x" => "1", "y" => "3"})
    "/macaw/proxy/tiles?x=1&y=3&z=2"

---

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