Test whether an H3 cell is one of the 12 pentagon cells at its resolution.
H3_IS_PENTAGON(cell)
## Overview Returns TRUE when the input cell is one of the 12 pentagonal cells that exist at every H3 resolution. Pentagons are an unavoidable consequence of tiling a sphere with hexagons: the underlying icosahedral projection requires exactly 12 pentagon cells per resolution, located at the vertices of the icosahedron. Most of the planet is covered by hexagons, but any code that walks neighbors or expands rings must handle the pentagon case because pentagons have only 5 neighbors instead of 6. Use this function to flag pentagon cells before ring expansions, to exclude them from strict-hexagon analytics, or to measure how often a region of interest touches one of the twelve pentagon chains. ## Behavior - Returns a BOOLEAN. - Returns TRUE for the 12 pentagon cells at each of the 16 resolutions (192 pentagon cells total). - Returns FALSE for ordinary hexagon cells and for any invalid or NULL cell. - Pentagons have 5 neighbors, 5 vertices, and slightly smaller area than surrounding hexagons. - The set of pentagon cells is fixed by the H3 specification; pentagon positions are stable across all implementations. - Pentagon cells have pentagon descendants: the center child of a pentagon is itself a pentagon, and one of the 6 non-center children is also a pentagon (so the pentagon lines propagate through the hierarchy). ## H3 pentagon reference - Exactly 12 pentagons per resolution (one per icosahedron vertex). - Pentagon neighbors (one ring): 5 cells instead of the 6 of a hexagon. - Pentagon area: approximately 5/6 of the area of surrounding hexagons at the same resolution. - Pentagon descendants: one pentagon child at each finer resolution, extending indefinitely. ## Compatibility - Follows the standard H3 hierarchical hex grid specification for pentagon identification.
| Name | Type | Description |
|---|---|---|
cell | Specifies the H3 cell index to test. Must be a valid H3 cell. |
-- Expect FALSE for any ordinary city-scale cell.
SELECT H3_IS_PENTAGON(H3_LATLNG_TO_CELL(51.5074, -0.1278, 7)) AS is_pent;
-- Mark rows where neighbor logic might behave differently.
SELECT h3_cell,
events,
H3_IS_PENTAGON(h3_cell) AS pentagon
FROM analytics.curated.h3_events_res7
WHERE event_date = CURRENT_DATE;
-- Drop cells that would produce 5-neighbor rings before running a k-disk join.
SELECT event_id
FROM analytics.curated.h3_events_res9
WHERE NOT H3_IS_PENTAGON(h3_cell);
-- There are exactly 12 pentagons at every resolution. This query verifies the invariant.
SELECT resolution, COUNT_IF(H3_IS_PENTAGON(cell_id)) AS pentagon_count
FROM spatial.reference.h3_grid_sampled
GROUP BY resolution
ORDER BY resolution;