H3_FromPoint - Amazon Redshift

H3_FromPoint

H3_FromPoint returns the corresponding H3 cell ID from an input geometry point and resolution. For information about H3 indexing, see H3.

Syntax

H3_FromPoint(geom, resolution)

Arguments

geom

A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type. The geom must be a POINT.

resolution

A value of data type INTEGER or an expression that evaluates to an INTEGER type. The value represents the resolution of the H3 grid system. The value must be an integer between 0–15, inclusive. With 0 being the coarsest and 15 being the finest.

Return type

BIGINT – represents the H3 cell ID.

If geom is not a POINT, then an error is returned.

If resolution is out of bounds, then an error is returned.

If geom is empty, then NULL is returned.

Examples

The following SQL returns the H3 cell ID from point 0,0, and resolution 10.

SELECT H3_FromPoint(ST_GeomFromText('POINT(0 0)'), 10);
h3_frompoint ------------------- 623560421467684863