Amazon Redshift will no longer support the creation of new Python UDFs starting November 1, 2025.
If you would like to use Python UDFs, create the UDFs prior to that date.
Existing Python UDFs will continue to function as normal. For more information, see the
blog post
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
GEOMETRYor an expression that evaluates to aGEOMETRYtype. The geom must be aPOINT. - resolution
-
A value of data type
INTEGERor an expression that evaluates to anINTEGERtype. The value represents the resolution of the H3 grid system. The value must be an integer between 0–15, inclusive. With0being the coarsest and15being 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