H3_Center - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

H3_Center

H3_Center returns the centroid of an H3 cell ID from an input index. For information about H3 indexing, see H3.

Syntax

H3_Center(index)

Arguments

index

A value of data type BIGINT or VARCHAR that represents the index of an H3 cell. Or, an expression that evaluates to one of these data types.

Return type

POINT – represents the centroid of the H3 cell with spatial reference system identifier (SRID) of 0.

If index is not valid, then an error is returned.

Examples

The following SQL inputs a VARCHAR that represents the index of an H3 cell, and returns a POINT with SRID of 0 that represents the centroid of the input H3 cell.

SELECT H3_Center('8025fffffffffff');
h3_center -------------------------------------------- 010100000070707A550B605940AEE9D70B327E4640

The following SQL inputs a BIGINT that represents the index of an H3 cell, and returns a POINT with SRID 0 that represents the centroid of the input H3 cell.

SELECT H3_Center(577129255373111295);
h3_center -------------------------------------------- 010100000070707A550B605940AEE9D70B327E4640

The following SQL inputs a VARCHAR that represents the index of an H3 cell, and returns a POINT with SRID 0 that represents the centroid of the input H3 cell. The output of H3_Center is input to ST_AwEWKT to display in extended well-known text (EWKT) representation.

SELECT ST_AsEWKT(H3_Center('8075fffffffffff'));
st_asewkt ----------------------------------------- POINT(-5.24539029677733 2.30088211162675)