H3 polygon fill (polygonToCells)
The cells that fill a polygon (with holes, across the antimeridian) at a resolution, by an explicit containment mode: cell centers inside, whole cells inside, or any overlap.
Go the other way: H3 cell set outline (cellsToMultiPolygon) →
The polygon fills with 9 cells by center containment.
| Cell |
|---|
| 892a8471403ffff |
| 892a847140bffff |
| 892a8471413ffff |
| 892a847141bffff |
| 892a8471447ffff |
| 892a8471453ffff |
| 892a8471457ffff |
| 892a84714c7ffff |
| 892a84714cfffff |
- Containment used
- Estimate
- Covered area
- South
- West
- North
Provenance
- Computed by
- indexing.h3.polygon-to-cells 1.0.0, core 0.1.0
- Model
- H3 C polygonToCells containment tests (point in polygon on latitude and longitude, boundary crossings), breadth-first fill from cells along every edge
- Accuracy
- Identical cell sets to H3 C 4.4.1 in center, full, and overlapping modes on 1,000 random polygons with holes and antimeridian crossings
- Notes
- None
- Cites
- Uber Technologies and the H3 contributors, H3: A Hexagonal Hierarchical Geospatial Indexing System (API reference v4); Hydronium Labs, h3o: a Rust implementation of H3
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: H3 C polygonToCells containment tests (point in polygon on latitude and longitude, boundary crossings), breadth-first fill from cells along every edge
Accuracy: Identical cell sets to H3 C 4.4.1 in center, full, and overlapping modes on 1,000 random polygons with holes and antimeridian crossings
When to use this: Use this to turn an area into cells: the H3 cells that fill a polygon, with holes and across the antimeridian, at a resolution you choose. It is how a region, a service area, or an administrative boundary becomes a set of keys that rows can be joined on.
Limitations: Which cells count as inside is a choice, not a fact, so the containment mode has to be stated: centers inside, whole cells inside, or any overlap all give different sets, and the difference is largest at coarse resolutions relative to the polygon. A fine resolution over a large area produces very many cells. A polygon cannot take in a pole: H3 reads a ring in latitude and longitude with straight edges, so a ring at one latitude encloses no area and comes back with nothing rather than with the cap it looks like.
Worked example: A block in downtown Pittsburgh at resolution 9. Source: H3 polygonToCells. It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Containment
- center
- Polygon
- 40.4406, -80.002 40.4406, -79.99 40.448, -79.99 40.448, -80.002
- Resolution
- 9
You get
- Cells
- 9
- Containment used
- center
- Estimate
- 28
- Covered area
- 0.947955 km²
- South
- 40.438996519°
- West
- -80.003535216°
- North
- 40.448391063°
- East
- -79.988032515°
Review: Not yet independently reviewed by a GIS professional.
Last verified: 2026-09-18, 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
- 2026-09-19, changed: Every indexing tool is now stable. Geohash decode and neighbors match pygeohash on 1,000 and 500 cases; the Plus Code tools pass every row of the Open Location Code test data; tile ground resolution matches the Bing Maps table; the H3 resolution chooser matches H3's resolution table; and H3 polygon fill gives H3 C's own test counts (1,253 cells, 1,214 with a hole). Results are unchanged apart from the fix below. Changelog
- 2026-09-19, changed: Large H3 polygon fills run about four times faster on the web and in the MCP server (a 250,000-cell county-sized fill: 12.5 s to about 3 s), because the H3 code is now compiled for speed instead of size. Results are unchanged. Changelog
Checked against: 23 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- H3: A Hexagonal Hierarchical Geospatial Indexing System (API reference v4), Uber Technologies and the H3 contributors, H3 4.x documentation. Indexing, inspection, traversal, hierarchy, directed edges, vertexes, and resolution tables. Read free.
- h3o: a Rust implementation of H3, Hydronium Labs, 0.11.0 (tested against H3 C). CellIndex, LatLng, Resolution. Read free.
Terms
- H3: H3 hexagonal hierarchical index
- A global grid of hexagons (and 12 pentagons) at 16 resolutions, each cell about one-seventh the area of its parent, named by a 15-character index. Source: H3 hexagonal index
H3 — H3 hexagonal hierarchical index
A global grid of hexagons (and 12 pentagons) at 16 resolutions, each cell about one-seventh the area of its parent, named by a 15-character index.
Source: H3 hexagonal index