H3_FromLongLat - Amazon Redshift

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 a DOUBLE PRECISION type.

latitude

A value of data type DOUBLE PRECISION or an expression that evaluates to a DOUBLE PRECISION type.

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 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