H3_Polyfill - 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_Polyfill returns the corresponding H3 cell IDs that correspond to the hexagons and pentagons that are contained in the input polygon of the given resolution. For information about H3 indexing, see H3.


H3_Polyfill(geom, resolution)



A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type. The geom must be a POLYGON.


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

SUPER – represents a list of H3 cell IDs.

If geom is not a POLYGON, then an error is returned.

If resolution is out of bounds, then an error is returned.

If geom is empty, then NULL is returned.


The following SQL returns a SUPER data type array of H3 cell IDs from a polygon and resolution 4.

SELECT H3_Polyfill(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'), 4);
h3_polyfill ---------------------------------------------------------------------------------------------------------------------------------------------------------- [596538848238895103,596538805289222143,596538856828829695,596538813879156735,596537920525959167,596538685030137855,596538693620072447,596538839648960511]