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
GEOMETRY
or an expression that evaluates to aGEOMETRY
type. The geom must be aPOLYGON
. - 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
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]