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_FromLongLat
H3_FromLongLat returns the corresponding H3 cell ID from an input longitude, latitude, and resolution. For information about H3 indexing, see H3.
Syntax
H3_FromLongLat(longitude, latitude, resolution)
Arguments
- longitude
-
A value of data type
DOUBLE PRECISIONor an expression that evaluates to aDOUBLE PRECISIONtype. - latitude
-
A value of data type
DOUBLE PRECISIONor an expression that evaluates to aDOUBLE PRECISIONtype. - 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 resolution is out of bounds, then an error is returned.
Examples
The following SQL returns the H3 cell ID from longitude 0, latitude 0, and resolution 10.
SELECT H3_FromLongLat(0, 0, 10);
h3_fromlonglat
-------------------
623560421467684863