---
title: "Get Layer Viz Stats"
method: GET
path: "/api/v1/map/{layer_id}/viz-stats"
tags: ["map"]
---

# Get Layer Viz Stats

`GET /api/v1/map/{layer_id}/viz-stats`

Whole-layer classed-styling stats for one column.

Drives classed map styling on the client — quantile breaks for numeric
columns, bucketed categories for boolean/text ones. Either way the scale
must come from the full dataset, not the rendered viewport, or the same
feature changes class as the user pans.

## Query parameters

- `column` string, required
- `token` string, nullable — Firebase ID token for MVT authentication

## Response `200`

Successful Response

- union
  - NumericVizStats — Whole-layer stats for one numeric column, for classed map styling. ``breaks`` are the deduped ascending interior quintile boundaries (p20/p40/p60/p80); together with ``min``/``max`` they delimit up to five classes. Empty ``breaks`` with ``count`` 0 means the column has no non-null values. ``geometry_kind`` tells the client which classed styling applies (graduated circles for points, choropleth otherwise) — every layer carries both point and fill style layers, so the client cannot infer geometry from the style alone.
    - `kind` 'numeric'
    - `breaks` number[], required
    - `min` number, nullable, required
    - `max` number, nullable, required
    - `count` integer, required
    - `geometry_kind` 'point' | 'line' | 'polygon', nullable, required
  - CategoricalVizStats — Whole-layer stats for one boolean or text column, for classed map styling. ``categories`` is the top slice by count (descending, ties broken by value ascending); anything past the cap is summed into ``other_count``. NULL and empty string are never categories — they are one "no value" class carried by ``null_count``. ``count`` is the non-null population, so ``count - sum(categories) == other_count``.
    - `kind` 'categorical'
    - `categories` VizCategory[], required
      - `value` string, required
      - `label` string, required
      - `count` integer, required
      - `color_index` integer, required
    - `other_count` integer, required
    - `null_count` integer, required
    - `count` integer, required
    - `geometry_kind` 'point' | 'line' | 'polygon', nullable, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/maia-analytics/apis/maia-api.md) · [All operations](https://skmtc.net/maia-analytics/apis/maia-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/maia-analytics/maia-api/versions/ba2b8d962161/schema)
