geoprimsField-grade geospatial math

S2 cell hierarchy

An cell's parent, its ancestor at any coarser level, and its four children.

89c25a3

89c25a3 is a level 12 cell.

Children
Cell
89c25a24
89c25a2c
89c25a34
89c25a3c
Level
Parent
Ancestor
Provenance
Computed by
indexing.s2.hierarchy 1.0.0, core 0.1.0
Model
S2 geometry and Web Mercator tile arithmetic, as the general S2 and tile tools compute them
Accuracy
Exact for indexes and tokens; S2 areas to the precision of the cell's spherical polygon
Notes
None
Cites
Google, S2 Geometry

Something look off?

Your values

Showing an example. Change anything.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: S2 geometry and Web Mercator tile arithmetic, as the general S2 and tile tools compute them

Accuracy: Exact for indexes and tokens; S2 areas to the precision of the cell's spherical polygon

When to use this: Use this to roll S2 data up or down a level: aggregate fine cells into their parents, look up the coarse cell a fine one belongs to, or split a cell into its four children. Paste the token or cell id, and optionally a coarser level for its ancestor there. The tool returns the parent one level up, the ancestor, and the four children in Hilbert order.

Limitations: An S2 cell has exactly one parent and four children, except at level 0, which has no parent, and level 30, which has no children. The children are listed in Hilbert-curve order, not by position. The ancestor level must not be finer than the cell's own.

Worked example: A level 12 cell's ancestor at level 6. Source: S2 and slippy-map conventions, computed by the core. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.

You enter

S2 cell
89c25a3
Ancestor level
6

You get

S2 cell
89c25a3
Level
12
Parent
89c25a4
Ancestor
89c3

Review: Not yet independently reviewed by a GIS professional.

Last verified: 2026-09-22, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.

Status: version 1.0.0, core 0.1.0. See this tool in the verification report.

Changes

Checked against: 22 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.

Sources

Terms

S2: S2 Geometry
A way of indexing the sphere: the Earth is projected onto a cube, each face is traced by a Hilbert curve, and a cell is a position along that curve at a level from 0 to 30. Source: S2 Geometry

S2 — S2 Geometry

A way of indexing the sphere: the Earth is projected onto a cube, each face is traced by a Hilbert curve, and a cell is a position along that curve at a level from 0 to 30.

Source: S2 Geometry