What a machine does with it

A cell system trades area for shape

A grid can hold every cell to exactly the same area or hold every cell nearly square, and the measurement says it cannot do both: the equal-area cube's areas agree to a part in a thousand and its worst cell is 1.29 times as long as it is wide, while the tangent-warped cube holds shape to 1.19 and lets area vary by 20 per cent.

Two rungs have established what a cell scheme is asked for: equal areas, so that a count per cell is a density, and compact shapes, so that a neighbourhood query fetches few cells. The obvious question is whether a scheme can have both.

It cannot, and unlike the twelve pentagons this is not a theorem — it is a measurement, made on four schemes with the same code and the same two criteria.

Equal area or steady shape, and not both. Four cell schemes plotted by how much their cells vary in area and how far from square the worst of them is. The bottom-left corner is the scheme that has both, and it is empty: the equal-area cube holds area to 1.003 and has the most elongated cells, the tangent-warped cube has the tightest shapes and lets area vary by 1.20, and the lon/lat scheme is off the scale on both. Neither axis can be driven to one while the other stays there.
Fig. 1 Four cell schemes placed by how much their cells vary in area and how far from square the worst of them is. The bottom-left corner would be a scheme with both, and it is empty. The equal-area cube holds area to within a part in a thousand and has the most elongated cells of the three cube schemes; the tangent-warped cube has the tightest shapes and lets area vary by 20 per cent.

The four schemes

The lon/lat quadtree, from the first rung: boundaries along the graticule, areas varying by a factor that doubles with every level.

The raw cube. Six square faces of a cube inscribed about the sphere, each divided into a quadtree, each cell projected outward from the centre. That is the inverse gnomonic, so the cells near a face’s centre are smaller on the sphere than the ones at its corners.

The tangent-warped cube. The same, with each coordinate passed through u ↦ tan(uπ/4) before projecting. The warp is the one Google’s S2 library uses, and it exists to undo most of the gnomonic’s stretch.

The equal-area cube. The same six faces, with the area-preserving face map from what a face can preserve instead of the gnomonic — inverted, so that a uniform grid on the flat square becomes a grid of exactly equal spherical cells.

That last one is worth pausing on as a piece of construction. The polyhedral ladder built an area-preserving map from a spherical face onto a flat one by integrating an ordinary differential equation; inverting it costs a bisection on a monotone function and a closed form for the radius. The cell scheme is then free: a uniform grid on the flat face has cells of exactly equal plane area, so their images have exactly equal spherical area.

What the measurements say

Every area below is computed with the spherical polygon formula applied to the cell’s own boundary, not derived from the construction — the point of an equal-area scheme is that the measurement comes out constant, and asserting it from the construction would be the construction repeated.

At level 2, which is 96 cells for the cube schemes:

scheme area spread worst aspect ratio mean aspect
raw cube 2.479 1.205 1.103
tangent-warped cube 1.202 1.189 1.094
equal-area cube 1.003 1.289 1.144
lon/lat quadtree 2.410 2.610

and at level 3, 384 cells:

scheme area spread worst aspect ratio
raw cube 3.790 1.315
tangent-warped cube 1.281 1.291
equal-area cube 1.003 1.394
lon/lat quadtree 5.030 5.130

Three things are readable there and all three matter.

The warp works. The raw cube’s area spread is 2.48 and the tangent one’s is 1.20, for a shape cost of nothing — the tangent scheme is better than the raw one on both criteria. That is not a trade-off, it is a strictly better construction, and it is why S2 warps.

The equal-area scheme is exactly equal-area. Its 1.003 is not a residual of the construction but of the measurement, which approximates each curved cell boundary by a polygon: refining that sampling drives the spread toward one as the square of the step, fitted here at −2.01. The construction is exact and the number that is printed is a measurement of a drawing.

And it pays in shape. Its worst aspect is 1.289 against the tangent scheme’s 1.189 at level 2, and 1.394 against 1.291 at level 3. The gap is not enormous and it is systematic: forcing the areas to agree makes the cells that would have been small into cells that are the right size and the wrong shape.

Equal-area cube cells, shaded by area. The equal-area cube at level 2, drawn on Mollweide with each cell shaded by its own measured area. The largest cell is 1.01 times the smallest. Every area is computed with the spherical polygon formula from the cell's own boundary, not from the scheme's intentions, and the shading is what the numbers say rather than what the mesh looks like.
Fig. 2 The equal-area cube’s cells, shaded by measured area. The shading is nearly uniform, which is the point — every cell has the same area to a part in a thousand — and the cells are visibly less square near the face corners than the tangent scheme’s are.
Tangent-warped cube cells, shaded by area. The tangent-warped cube at level 3, drawn on Mollweide with each cell shaded by its own measured area. The largest cell is 1.29 times the smallest. Every area is computed with the spherical polygon formula from the cell's own boundary, not from the scheme's intentions, and the shading is what the numbers say rather than what the mesh looks like.
Fig. 3 The tangent-warped scheme at level 3, shaded the same way. The area variation is visible as a six-fold pattern with its extremes at the cube’s eight corners, and it is 28 per cent — small enough to ignore for a rendering and much too large to ignore for a count per cell.

The trade also has an exchange rate, and it is worth reading off the two tables because it is not what the plot’s shape suggests. Going from the tangent-warped scheme to the equal-area one buys 0.199 of area spread at level 2 — 1.202 down to 1.003 — for 0.100 of worst aspect ratio, 1.189 up to 1.289. At level 3 the same move buys 0.278 and costs 0.103. The cost in shape is essentially constant across the two levels and the purchase in area grows, so the equal-area scheme’s case gets stronger as the grid is refined, and a comparison made at a coarse level understates it.

That is the opposite of how the raw cube behaves and for a related reason. The tangent warp is an approximate inverse of one particular projection, so what it fails to cancel is a residual that grows as the grid reaches further into the face corners where the gnomonic’s stretch is worst. The equal-area construction is not an approximation of anything: it inverts an exact map, so its area spread is one at every level and only its shapes are left to degrade. A scheme whose defect is an approximation error and a scheme whose defect is a geometric fact behave differently under refinement, and the tables show it as one column moving and the other standing still.

The raw cube’s failure, read off the projection it is

The raw cube scheme is worse than the other two at everything, and it is worth saying exactly why, because the reason is a projection this site has already measured.

Laying a uniform grid on a face and projecting outward from the centre of the sphere is the gnomonic projection, inverted. The globe on a solid measures what the gnomonic does across a cube face: the areal factor runs from 1.00 at the face’s centre to 4.46 at its corners. So a uniform grid on the flat face becomes a grid whose spherical cells are largest at the face centre and smallest at the corners, by very nearly that factor.

Raw cube cells, shaded by area. The raw cube at level 3, drawn on Mollweide with each cell shaded by its own measured area. The largest cell is 3.82 times the smallest. Every area is computed with the spherical polygon formula from the cell's own boundary, not from the scheme's intentions, and the shading is what the numbers say rather than what the mesh looks like.
Fig. 4 The raw cube at level 3, shaded by measured area. The pattern is the gnomonic’s areal factor drawn as a mesh: large cells at each face’s centre, small ones at the corners, and a ratio of 3.79 across the scheme. Every one of those cells is a quarter of its parent exactly, which is what makes this a usable index and does nothing at all about the areas.

The warp is therefore not a fudge but a partial inverse: tan(uπ/4) is chosen so that equal steps in u become nearly equal steps of arc, which is exactly what undoing a gnomonic requires. It gets the spread from 3.79 to 1.28 with one elementary function, and what is left is the residual of an approximation rather than of a construction.

The lon/lat scheme is not on the same scale as the others

The fourth row of the tables is off the chart, and the reason is worth repeating in this company.

At level 3 the lon/lat scheme’s area spread is 5.03 and its worst aspect ratio is 5.13, against a cube scheme’s 1.28 and 1.29. It is worse on both criteria by a factor of four, and — the part that matters — its numbers grow with the level while the cube schemes’ do not grow the same way: 10.15 at level 4, 40.74 at level 6, 162.97 at level 8.

The comparison is not close and it is not a matter of taste. Any of the three cube schemes dominates the graticule-based one at every level and on both criteria, which is why no serious global grid is built on the graticule and why the schemes people actually use — S2, H3, DGGRID’s family — are all built on a solid.

The measurement that had to be checked before any of this could be believed

An equal-area claim measured by a method with its own bias is worth nothing, and the bias here is easy to see once looked for.

A cell’s boundary is a straight line in the face’s plane and a curve on the sphere. Measuring the cell’s area from a polygon through a finite number of points along each edge under-reports it, by an amount that depends on how curved that edge is — so the measurement systematically favours some cells over others and could manufacture a spread out of an exactly equal-area scheme.

Two checks separate the scheme from the measurement:

  • The total is exactly 4π at every sampling density. Every edge is shared by two cells and the two errors are equal and opposite, so the sum is unaffected. That means the total could never have caught this problem, and it is the check most people would run.
  • The spread converges as the square of the step. Measured at 4, 8, 16 and 32 samples per edge, the excess falls 0.11, 0.028, 0.0069, 0.0017 — a fitted exponent of −2.01, which is the signature of a polygon approximating a curve and not of a scheme with unequal cells.

The site’s habit of measuring convergence rather than accepting a number is what makes the difference between “the areas agree to a part in a thousand” and “the areas are equal, and here is why the number is not zero”.

An address's precision is an area. The area of one equatorial cell of a lon/lat quadtree against the level, on log axes. Each level quarters the area, so the line is straight and its slope is a fact about the scheme rather than about the Earth. What an identifier of a given length names is a region of 1554827 km² at level 4 and 6112.6 km² at level 8 — and at any level the same identifier length names a region 1.0 times smaller near the pole than at the equator.
Fig. 5 The quartering law that every one of these schemes shares, on the lon/lat scheme where it is exact by construction. The hierarchy is the property none of the trade-offs touch: whatever a scheme does to areas and shapes, a cell’s children partition it precisely, which is what makes the identifier searchable.

Why the trade-off is the same one the whole site is about

Nothing above proves that no scheme can have both, and it is worth being careful about that. What has been measured is that three schemes on the same solid sit at three points of a trade, and that the one which fixes area has the worst shapes.

The reason to expect it in general is the same two-line argument the trade-off is two lines makes about projections. A cell scheme is a projection of the sphere onto a set of flat faces, plus a grid on those faces. Holding every cell’s area exactly fixes the areal factor at one everywhere, which is an equal-area map; holding every cell’s shape exactly would fix the two principal scales equal everywhere, which is a conformal map; and a map that is both is an isometry, which the curvature forbids.

So the corner of the plot is empty for the same reason the corner of every plot on this site is empty, and the finite gap between the schemes is a measurement of how much of the impossibility each one has chosen to absorb.

A hexagonal tiling of the sphere, and its pentagons. 362 cells — 350 hexagons and 12 pentagons, the pentagons marked — drawn on Orthographic. The twelve are not a defect of the construction and cannot be removed by subdividing further: Euler's formula requires exactly twelve however many hexagons there are. Each pentagon here has 0.52 times the area of an average hexagon, so a count aggregated over these cells has twelve entries that mean something different from all the others.
Fig. 6 The hexagonal alternative, for comparison: better shapes than any cube scheme — a hexagon is the most compact tile there is — at the price of twelve cells that are not hexagons at all, and an area spread of 2.5 in this construction. It sits in a different part of the same trade rather than outside it.

What the numbers do as the grid is refined

A comparison at one level is a comparison at one level, and the schemes do not all behave the same way as the cells get smaller.

The equal-area scheme’s area spread stays at exactly one by construction, at every level, forever. Its worst aspect ratio grows slowly — 1.289 at level 2, 1.394 at level 3 — because the cells near a face’s corner are the ones being stretched and they stay in the same relative position as the grid refines.

The tangent-warped scheme’s area spread grows: 1.20 at level 2, 1.28 at level 3. That is a small growth and it is a growth, and it means the scheme’s quality claim has a level attached to it.

The raw cube’s grows fastest — 2.48 to 3.79 — for the same reason the globe on a solid gives: the gnomonic’s areal factor keeps rising toward the face corners, so refining the grid puts more cells in the region where the stretch is worst.

The lon/lat scheme’s grows without bound, doubling with every level, which is the finding of the first rung.

The ordering by growth rate is therefore not the ordering by value at any single level, and a scheme chosen on a level-2 comparison and deployed at level 12 is a scheme chosen on the wrong number. That is the same trap distortion over a region sets for projections: a quantity measured over one region, or at one resolution, is not a property of the thing.

What to choose, if the question has to be answered

The site refuses to name a best projection without an objective, and the same refusal applies here with the same structure. The objective is set by the operation, which the first rung listed:

  • Aggregating counts into densities needs equal area and tolerates elongated cells, so the equal-area cube is the right answer and the shape cost is one that shows up only in query performance.
  • Neighbourhood and proximity queries need compact cells and tolerate area variation, so the tangent-warped cube or a hexagonal grid is right.
  • Joining datasets needs neither, and the correct choice is whichever scheme the other dataset used — a point too obvious to be worth measuring and the one that decides most real cases.

That is the same conclusion the operation decides the coordinate system reaches for coordinates, arriving at the level of the index rather than the level of the number.

Twelve pentagons, however many hexagons. Five hexagonal tilings of the sphere, from 42 cells to 642. The hexagon count rises by a factor of 21 and the pentagon count does not move: it is twelve, exactly, in every one. Euler's formula forces it — three faces at each vertex and only pentagons and hexagons leaves p = 12 whatever h is — and a tiling of hexagons alone gives χ = 0 rather than 2, so it does not exist.
Fig. 7 The hexagonal family’s own version of the trade, for comparison with the cube schemes’ plot: the pentagon count is flat at twelve however large the tiling grows. A hexagonal grid’s anomaly is a fixed set of twelve cells and a cube grid’s is a spread across every cell, which is a different shape of defect rather than a smaller one.

Where the model stops

Only cube-based schemes are measured on the exact trade-off. The hexagonal grids are measured on their own terms in the previous rung and are not on the same axes, because their cells are not quadrilaterals and the aspect ratio of a hexagon is a different quantity from the aspect ratio of a near-square.

The cells are quadrilaterals with curved edges, and every area here is measured from a polygon through points along those edges. That approximation is what the convergence check above is about, and it is the same class of decision densification forces on any stored boundary: a curve represented by points is a curve with a tolerance attached, and the tolerance has to be stated before any area computed from it means anything.

Aspect ratio is one shape measure among several. The perimeter-to-area ratio would rank the schemes similarly and not identically, and a query engine cares about the number of cells a disc intersects, which is a third quantity. Nothing here is a claim about which shape measure a real system should use.

The level-3 numbers do not extrapolate indefinitely. The raw cube’s area spread grows with the level — 2.48 at level 2, 3.79 at level 3 — because the extremes move toward the face corners, while the tangent scheme’s and the equal-area scheme’s do not grow the same way. Comparing schemes at one level is comparing them at one level.

The hierarchy is what none of this touches

Every quantity in this essay is metric — an area, a shape, a ratio — and every one of them is fought over. The property that makes a cell scheme useful, though, is not metric at all, and it is the same on all four.

A cell’s children partition it exactly. The four cells one level down whose identifiers extend a cell’s identifier by one step cover precisely that cell and nothing else, whatever the warp. That is what lets an index be walked, a query prune a subtree, and two datasets at different levels be joined by prefix.

Containment survives every projection because a projection is continuous and one-to-one on a face, and containment is a statement about which sets are inside which. So the trade-off measured here is entirely inside the metric half of the problem, and the half that matters most for a database is untouched by it — which is worth stating, because a reader who has just been shown four schemes disagreeing might conclude the choice is fraught. It is fraught for aggregation and irrelevant for indexing, and knowing which is which is most of the decision.

Lon/lat quadtree cells, shaded by area. The lon/lat quadtree at level 3, drawn on Mollweide with each cell shaded by its own measured area. The largest cell is 10.15 times the smallest. Every area is computed with the spherical polygon formula from the cell's own boundary, not from the scheme's intentions, and the shading is what the numbers say rather than what the mesh looks like.
Fig. 8 The graticule-based scheme at level 3 for comparison with the cube schemes above, shaded by the same measurement. Its polar rows are drawn as slivers because they are slivers, and the picture is the fourth row of both tables — the scheme every serious global grid was built to replace.

Who found it, and when

The tangent warp is folklore in the graphics literature and was in use in the “quadrilateralised spherical cube” that NASA’s COBE mission used for its all-sky maps in the early 1990s — a scheme designed for exactly the reason this ladder is about, since a map of the microwave background is a count per cell and needs equal areas.

The exact equal-area map of a square onto a sphere face has been derived several times: Snyder’s polyhedral projection of 1992 gives it for any regular solid, and Roşca and Plonka published an explicit area-preserving cube map in 2011. The version used here is the first of those, inverted.

What appears to be genuinely uncommon is the comparison: three schemes on the same solid, measured on the same two criteria with the same code, so that the trade between them is a pair of numbers rather than an argument about which library to use.

Where the ladder goes next

The cells anchor now has an address, an obstruction and a trade-off. What it does not have is the question a working system asks next: how many cells does a query touch? That is a measurement about discs and boundaries rather than about single cells, it depends on the scheme’s shapes in a way the aspect ratio only approximates, and it is work this collection has not done.

Named alongside this one

Essays reaching for the same objects. Nobody chose these; they are what the concept index makes visible.

What links here

The 8 essays that link to this one and share the most of its objects, of 10 that link here.

The objects this essay names

Each one links to every other essay that touches it.

AggregationAnisotropyCellClosed formConvergenceDiscrete global gridEqual-areaPolyhedral projectionToleranceTrade-off