---
url: /mosaic/examples/us-state-map.md
---
# U.S. States

A map of U.S. states overlaid with computed centroids. Requires the DuckDB `spatial` extension.

**Credit**: Adapted from an [Observable Plot example](https://observablehq.com/@observablehq/plot-state-centroids).

## Specification

```py \[Python]
import vgplot as vg

states = vg.spatial("data/us-counties-10m.json", layer="states")

view = vg.plot(
    vg.geo(states, stroke="currentColor", stroke_width=1),
    vg.dot(
        states,
        x=vg.centroid_x("geom"),
        y=vg.centroid_y("geom"),
        r=2,
        fill="steelblue",
        tip=True,
        title="name",
    ),
    vg.margin(0),
    vg.projection_type("albers"),
)

```
