S2 region visualizer

The 192 S2 cells that anchor every Axona pub/sub topic and nodeId — coloured by fold basin. Only 84 cells are populated major regions (named for a neutral in-range animal); the ~108 ocean and sparse cells fold into the nearest major, so a topic anchored in empty water lands in a real region instead of hotspotting a boundary. Cells sharing a colour share a major. Hover the globe for the fold relationship; click a legend swatch to highlight its cell.

Under cursor

Cell ID
Lat / Lng
Cell bounds
Approx area

Your location

Lat / Lng
Your cell

Display

Cell index

Click a cell to highlight it on the globe.
Cells are numbered by Hilbert-curve order 0x00 to 0xFF.

What you are seeing

Every Axona nodeId starts with an 8-bit S2 prefix derived from the peer's lat/lng via Google's S2 cube projection. The same 8-bit prefix anchors pub/sub topics: a topic descriptor's `region` byte places the topic in the keyspace, so K-closest routing for a region-keyed topic naturally finds peers in that region.

S2 projects the globe onto the six faces of a cube and partitions each face into 4×8 = 32 cells, giving 192 cells total. The quadratic ST transform keeps cell areas within ~1.4× of each other across the globe — no polar shrinkage. Byte values 0xC0–0xFF are reserved (192–255) for future system topics.

The fold. Roughly half the cells are open ocean or near-empty land — no peers live there. Minting an id at such a cell would make it a hotspot: every topic anchored in that ocean lands on the same few boundary nodes. So canonicalRegion() folds each ocean/sparse cell onto its nearest major at mint time (node ids and topic ids alike), and the topic spreads across that major's whole population. The fold is deterministic and carried in the id itself — no coordinator — and wire-compatible: every populated region keeps its exact byte. Regions are labelled with neutral animal names rather than country names (the id carries only the numeric code, never the label).