H3 & global grids
Indexing the earth into cells: H3 hexagons, S2, geohash and quadkeys — resolution, hierarchy and the joins they make cheap.
A discrete global grid turns a coordinate into a short key. That is the whole idea, and everything else follows from it: once a point is a string or a 64-bit integer, joining two datasets is an equality join, and an equality join runs in pandas, DuckDB, BigQuery, Spark or a key-value store with no CRS, no geometry column and no spatial index.
The price is at the edges. Two points a metre apart can fall in different cells and never meet; a polygon smaller than a cell can contain no cell centre and fill to nothing; and no grid gives you equal area, equal shape and simple arithmetic at once, so each system has given one of them up. Knowing which one is how you choose between H3, S2, geohash and quadkeys.
The pages below start with what the grids are and how their hierarchies work, move to the operations — indexing points, filling polygons, aggregating, joining — and end with the failures each system produces.
🧭 Start with the concepts
The ideas the how-to guides below assume you already have.
- Discrete Global Grids Explained: H3, S2, Geohash and Why Cells Beat Coordinates
- H3 Explained: How a Hexagonal Grid Indexes the Whole Earth
- Choosing an H3 Resolution: Cell Size, Counts and What Each Level Can Show
- H3 Hierarchy Explained: Parents, Children and Why They Do Not Nest Exactly
- Geohash Explained: Prefixes, Precision and the Edge Problem
- S2 Cells Explained: Squares on a Cube and When They Beat Hexagons
⚙️ Then do the task
Step-by-step walkthroughs with code you can copy and adapt.
- How to Assign Points to H3 Cells in Python
- How to Aggregate Points into H3 Hexagons and Map Them
- How to Fill a Polygon with H3 Cells
- How to Turn H3 Cells into a GeoDataFrame of Polygons
- How to Use H3 Neighbours for k-Ring Smoothing and Buffers
- How to Join Two Point Datasets on an H3 Index Instead of a Spatial Join
🔧 When it breaks
The errors this topic produces, with the cause explained rather than just the command.
- Fixing H3 Cells in the Wrong Place: Latitude and Longitude Order
- Fixing H3 Hexagons That Stretch Across the Map at the Antimeridian
- Fixing H3 Polygon Fill That Misses Cells or Returns Nothing
- Fixing H3 AttributeError After Upgrading: the v3 to v4 API Rename
- Fixing an H3 Map That Misleads: Unequal Cell Areas and Empty Cells
Learning paths through this topic
A curated route rather than a list — the guides in the order that builds on itself.
Related topics
Subjects that keep coming up alongside this one, most overlap first.