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, lattitude, resolution)
Arguments
- longitude
-
A value of data type
DOUBLE PRECISION
or an expression that evaluates to aDOUBLE PRECISION
type. - latitude
-
A value of data type
DOUBLE PRECISION
or an expression that evaluates to aDOUBLE PRECISION
type. - resolution
-
A value of data type
INTEGER
or an expression that evaluates to anINTEGER
type. The value represents the resolution of the H3 grid system. The value must be an integer between 0–15, inclusive. With0
being the coarsest and15
being 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