← Back

CoupView

April 5, 2026

CoupView is a proof-of-concept map for exploring historical coups and illegal leader turnover around the world. Events live as a GeoJSON feature collection rendered on a dark-themed MapLibre GL basemap, with a sidebar for searching and filtering by region, decade, outcome, and tag. Clicking a marker opens a popup with the event's title, description, and sourcing, so the map works as both an overview and a way to drill into a single case.

Each coup is color-coded by outcome directly in the GL style, not in application code. The circle layer's paint spec is a MapLibre match expression keyed on the feature's outcome property, and radius is driven by feature-state so hovering a marker grows it without touching React state at all:

const circleLayerPaint: CircleLayerSpecification["paint"] = {
  "circle-radius": [
    "case",
    ["boolean", ["feature-state", "hover"], false],
    14,
    10,
  ],
  "circle-color": [
    "match",
    ["get", "outcome"],
    "successful", OUTCOME_COLORS.successful,
    "failed", OUTCOME_COLORS.failed,
    "attempted", OUTCOME_COLORS.attempted,
    "plot", OUTCOME_COLORS.plot,
    "alleged", OUTCOME_COLORS.alleged,
    OUTCOME_COLORS.alleged,
  ],
  "circle-stroke-width": 2,
  "circle-stroke-color": "#020617",
  "circle-opacity": 1,
};

A separate R service (built with plumber) is scaffolded alongside the map to eventually serve model-based turnover predictions over the same event data, with the frontend already wired to call it through a small predict() client. The map itself, though, works entirely off the static dataset: filtering, search, and the legend all run client-side over the in-memory feature collection.