Skip to content

H3_POINT_TO_CELL

Returns the integer value of an H3 cell ID for a supplied GEOGRAPHY Point at a given resolution.

Syntax

sql
H3_POINT_TO_CELL(<point>, <target_resolution>)

Arguments

  • <point>: A GEOGRAPHY object representing a Point.
  • <target_resolution>: An integer between 0-15 (inclusive) specifying the H3 resolution of the returned cell.

Returns

A BIGINT cell number representing the cell that covers the supplied point at the given target resolution. Resolution outside a valid range results in an error, as does supplying anything other than a single-coordinate point.

Example

sql
SELECT h3_point_to_cell('POINT(0 0)'::geography, 3);
-- 592035265791393791