H3 vs S2: Geospatial Indexing System Selection Playbook

2026-03-06 · software

H3 vs S2: Geospatial Indexing System Selection Playbook

Date: 2026-03-06
Category: software
Purpose: A practical guide for choosing and operating H3 or S2 in production systems (search, mobility, telemetry, risk heatmaps, and geo analytics).


Why this matters

Most geo incidents are not about map rendering. They come from subtle indexing mismatches:

Choosing the right global grid system early reduces both latency and correctness debt.


One-screen mental model

Neither is universally better. Pick based on query shape + storage model + operational constraints.


Core geometry and hierarchy

H3

S2


Query-shape fit (decision table)

Prefer H3 when...

Prefer S2 when...


Distortion, uniformity, and the “don’t overpromise” rule

No global discrete grid is perfectly uniform on a sphere.

Operator rule:


Storage and indexing patterns

Pattern A: OLTP + geo filters

This keeps latency predictable and correctness exact.

Pattern B: OLAP cube / telemetry lake

Pattern C: Hybrid serving (hot + cold)


Resolution/level selection heuristics

Choose from SLO backward, not from map aesthetics.

  1. Define target use-case radius (or minimum polygon feature size).
  2. Set max candidate expansion budget (cells/query at p99).
  3. Pick the coarsest level that keeps false positives manageable.
  4. Validate in three stress zones:
    • high density urban area
    • sparse rural/ocean area
    • antimeridian/high-latitude edge cases

A common anti-pattern is choosing too-fine cells first, then paying for fan-out, cache churn, and compaction pain forever.


Operational pitfalls (seen in production)

  1. Treating cell match as exact containment

    • Fix: always run exact geometry final filter for strict APIs.
  2. Single-level-only modeling

    • Fix: keep at least two levels (serving + aggregation) and test cross-level consistency.
  3. Ignoring pentagon and boundary tests (H3)

    • Fix: include pentagon-heavy and boundary regression fixtures.
  4. Assuming key locality == geometric correctness (S2)

    • Fix: validate region coverers and post-filter logic separately.
  5. No migration strategy for level changes

    • Fix: dual-write old/new levels, shadow-read, then cut over with rollback window.

Benchmark protocol before committing

Measure both systems on your own data with identical workloads:

Decision quality is much better when made from benchmark deltas, not library popularity.


Practical recommendation template

Use this in architecture docs:

If this template is missing, the team is likely taking hidden geo debt.


Rule-of-thumb cheatsheet


References