Return the average edge length of an H3 cell in meters for its resolution.
H3_EDGE_LENGTH(cell)
## Overview Returns the average edge length of an H3 cell in meters at the cell's resolution. Because H3 cells are hexagons (plus twelve pentagons per resolution) tiling a sphere, the exact edge length varies slightly with location, but the variation is small at any given resolution. This function returns the published resolution-wide average, which is suitable for choosing a resolution by target scale, building rough distance estimates, and documenting cell sizes in metadata. Use it when you need a scale hint for a cell, for example to decide whether a resolution is fine enough to resolve an event or to estimate how many cells cover a corridor of a given width. ## Behavior - Returns a DOUBLE in meters. - Returns NULL if the input is NULL or not a valid H3 cell index. - The value depends only on the cell's resolution, not on its geographic location. - Pentagon cells have slightly shorter edges than surrounding hexagons at the same resolution; the returned average does not distinguish pentagons. - Deterministic: the same cell always returns the same edge length. - To get meters squared, use H3_CELL_AREA (edge length squared times approximately 2.598 for a hexagon). ## H3 resolution reference | Res | Average edge length | Average hex area | | --- | --- | --- | | 0 | 1,107,712 m (1,107 km) | 4.25 million km^2 | | 3 | 59,811 m (59.8 km) | 12,400 km^2 | | 5 | 8,544 m (8.54 km) | 253 km^2 | | 7 | 1,220 m (1.22 km) | 5.16 km^2 | | 9 | 174 m | 0.11 km^2 | | 10 | 65.9 m | 0.015 km^2 | | 12 | 9.4 m | 307 m^2 | | 15 | 0.5 m | 0.9 m^2 | ## Compatibility - Follows the standard H3 hierarchical hex grid specification for resolution-wise average edge lengths.
| Name | Type | Description |
|---|---|---|
cell | Specifies the H3 cell index whose edge length to return. Must be a valid H3 cell. |
-- Expect ~22,600 m at res 4, ~1,220 m at res 7, ~65.9 m at res 10.
SELECT
H3_EDGE_LENGTH(H3_LATLNG_TO_CELL(52.5200, 13.4050, 4)) AS res4_m,
H3_EDGE_LENGTH(H3_LATLNG_TO_CELL(52.5200, 13.4050, 7)) AS res7_m,
H3_EDGE_LENGTH(H3_LATLNG_TO_CELL(52.5200, 13.4050, 10)) AS res10_m;
SELECT H3_EDGE_LENGTH(H3_LATLNG_TO_CELL(35.6762, 139.6503, 6)) / 1000.0 AS edge_km;
-- Pick the finest resolution whose edge is still larger than 500 m.
SELECT MAX(resolution) AS best_res
FROM (
SELECT resolution,
H3_EDGE_LENGTH(H3_LATLNG_TO_CELL(40.7128, -74.0060, resolution)) AS edge_m
FROM (SELECT EXPLODE(SEQUENCE(0, 15)) AS resolution)
) t
WHERE edge_m >= 500;
-- A k-disk of radius k covers approximately k * edge_length meters.
SELECT h3_cell,
3 * H3_EDGE_LENGTH(h3_cell) AS approx_k3_radius_m
FROM analytics.curated.h3_hourly_counts;