Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
H3_Polyfill
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.
Syntax
H3_Polyfill(geom, resolution)
Arguments
- geom
-
A value of data type
GEOMETRYor an expression that evaluates to aGEOMETRYtype. The geom must be aPOLYGON. - 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
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.
Examples
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]