Return the WGS 84 latitude of the center of an H3 cell.
H3_CELL_TO_LAT(cell)
## Overview Returns the WGS 84 latitude in decimal degrees of the geometric center of an H3 cell. Every H3 cell has a well-defined center point located at the centroid of its hexagonal (or pentagonal) boundary. This function extracts just the latitude component; pair it with H3_CELL_TO_LNG when you need both coordinates. Use it to project cells back to point coordinates for distance calculations, geocoding, rendering, or serialization to downstream systems that operate on lat/lng pairs rather than cell IDs. ## Behavior - Returns a DOUBLE in the range [-90, 90]. - Returns NULL if the input is NULL or not a valid H3 cell index. - Cell centers are deterministic; the same cell always returns the same latitude. - The returned latitude is not guaranteed to equal the input of H3_LATLNG_TO_CELL because any point within a cell maps to the same cell; round-trip precision is bounded by the cell half-width at the given resolution. - Coordinates are on the WGS 84 ellipsoid; no SRID is involved. - Precision is limited only by DOUBLE floating-point (approximately 15 significant digits). ## H3 resolution reference | Res | Average edge length | Cell half-width (approx) | | --- | --- | --- | | 0 | 1,107 km | 1,000 km | | 7 | 1.22 km | 1 km | | 9 | 174 m | 150 m | | 12 | 9.4 m | 8 m | | 15 | 0.5 m | 0.4 m | ## Compatibility - Follows the standard H3 hierarchical hex grid specification for cell centroids.
| Name | Type | Description |
|---|---|---|
cell | Specifies the H3 cell index whose center latitude to return. Must be a valid H3 cell. |
-- Round-trip a known point: the cell center is close to the input latitude, within the cell half-width.
SELECT H3_CELL_TO_LAT(H3_LATLNG_TO_CELL(51.5074, -0.1278, 9)) AS lat;
SELECT
H3_CELL_TO_LAT(c) AS center_lat,
H3_CELL_TO_LNG(c) AS center_lng
FROM (SELECT H3_LATLNG_TO_CELL(-33.8688, 151.2093, 8) AS c);
-- Combine with Haversine to rank cells by distance from a reference point.
SELECT
h3_cell,
ST_DISTANCE_HAVERSINE(H3_CELL_TO_LAT(h3_cell), H3_CELL_TO_LNG(h3_cell), 40.7128, -74.0060) AS distance_m
FROM analytics.curated.geo_events_h3
ORDER BY distance_m
LIMIT 20;
-- Derive a 1-degree latitude band from a cell center.
SELECT FLOOR(H3_CELL_TO_LAT(h3_cell)) AS lat_band
FROM analytics.curated.geo_events_h3;