H3_CELL_AREA

Return the exact surface area of an H3 cell in square meters on the WGS 84 ellipsoid.

Category: h3Returns: DOUBLEDialect: Standard

Syntax

H3_CELL_AREA(cell)

Description

## Overview Returns the exact surface area of an H3 cell in square meters, measured on the WGS 84 ellipsoid. Although all cells at a given resolution have approximately the same area, the underlying icosahedral projection introduces small variations: cells near the center of an icosahedron face are slightly larger than those near the vertices, and pentagon cells are always smaller than the surrounding hexagons. This function accounts for those variations and returns the true area of the specific cell, not a resolution-wide average. Use it when you need accurate densities (events per m squared, population per hex), when summing coverage from a polyfill, or when computing area-weighted aggregates. For resolution-wide averages, see the H3 resolution reference below. ## Behavior - Returns a DOUBLE in square meters. - Returns NULL if the input is NULL or not a valid H3 cell index. - Area varies slightly by cell location at the same resolution; pentagon cells are approximately 5/6 the area of surrounding hexagons. - Deterministic: the same cell always returns the same area. - For kilometers squared, use H3_CELL_AREA_KM2 (which is H3_CELL_AREA divided by 1,000,000). - Area is the spherical surface area on the WGS 84 ellipsoid, not a projected 2D area. ## H3 resolution reference | Res | Average edge length | Average hex area | | --- | --- | --- | | 0 | 1,107 km | 4,357,449 km^2 | | 4 | 22.6 km | 1,770 km^2 | | 7 | 1.22 km | 5.16 km^2 | | 9 | 174 m | 105,332 m^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. Areas computed here match other engines that implement the same spec to within floating-point precision.

Parameters

NameTypeDescription
cellSpecifies the H3 cell index to measure. Must be a valid H3 cell produced by a function such as H3_LATLNG_TO_CELL, H3_CELL_TO_PARENT, or H3_STRING_TO_CELL. NULL or invalid cells return NULL.

Examples

-- Resolution 9 cell over downtown Paris, expect approximately 100,000 m^2 (0.1 km^2).
SELECT H3_CELL_AREA(H3_LATLNG_TO_CELL(48.8566, 2.3522, 9)) AS area_m2;
-- Each step finer reduces area by roughly a factor of 7.
SELECT
  H3_CELL_AREA(H3_LATLNG_TO_CELL(40.7128, -74.0060, 7)) AS res7_m2,
  H3_CELL_AREA(H3_LATLNG_TO_CELL(40.7128, -74.0060, 8)) AS res8_m2,
  H3_CELL_AREA(H3_LATLNG_TO_CELL(40.7128, -74.0060, 9)) AS res9_m2;
-- Divide a sensor count by the true cell area to produce a density in events per m^2.
SELECT
  h3_cell,
  event_count,
  event_count / H3_CELL_AREA(h3_cell) AS events_per_m2
FROM mobility.curated.h3_hourly;
-- 1 hectare = 10,000 m^2.
SELECT H3_CELL_AREA(H3_LATLNG_TO_CELL(51.5074, -0.1278, 8)) / 10000.0 AS area_hectares;
-- Sum cell areas to get the total coverage of a bounding polygon (minus boundary slivers).
SELECT SUM(H3_CELL_AREA(cell)) AS covered_m2
FROM (
  SELECT EXPLODE(H3_POLYFILL('POLYGON((-0.15 51.50, -0.15 51.52, -0.10 51.52, -0.10 51.50, -0.15 51.50))', 8)) AS cell
);

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →