Skip to main content
The functions below support various operations using the H3 geospatial indexing scheme.

H3_CELLTOBOUNDARY(h3_index)

Returns a POLYGON boundary box of the H3 index identified by the given h3_index.See Geohash-H3 for an example.

H3_CELLTOCENTERCHILD(h3_index, res)

Alias for H3_CELLTOFIRSTCHILD.

H3_CELLTOCHILDN(h3_index, res, i)

Returns the H3 index corresponding to the 0-based i th child at resolution res for the given h3_index. The value i should be less than the number of children returned from calling H3_CELLTOCHILDRENSIZE(h3_index, res).

H3_CELLTOCHILDPOS(h3_index, res)

Returns the position of the given h3_index within an ordered list of the children of the cell’s parent at resolution res. This is the inverse of H3_CHILDPOSTOCELL (H3_CELLTOCHILDN).

H3_CELLTOCHILDRENSIZE(h3_index, res)

Returns the number of child cells at resolution res for the given h3_index.

H3_CELLTOFIRSTCHILD(h3_index, res)

Returns the H3 index corresponding to the first child at resolution res for the given h3_index.This is equivalent to H3_CELLTOCHILDN(h3_index,res,0).

H3_CELLTOLASTCHILD(h3_index, res)

Returns the H3 index corresponding to the last child at resolution res for the given h3_index.This is equivalent to H3_CELLTOCHILDN(h3_index,res,H3_CELLTOCHILDRENSIZE(h3_index, res)-1).

H3_CELLTOPARENT(h3_index, res)

Returns the H3 index corresponding to the parent cell of the given h3_index at resolution res.

H3_CELLTOXY(h3_index)

Returns a WKT POINT corresponding to the centroid of the given h3_index.

H3_CHILDPOSTOCELL(i, h3_index, res)

Alias for H3_CELLTOCHILDN(h3_index, res, i).

H3_GEOMTOCELL(geom, res)

Returns the H3 index, similar to a geohash, for the cell containing the centroid of the geometry geom with the given resolution res. The higher the resolution, the more precise the index is. The resolution res must be an integer between 0 and 15.See Geohash-H3 for an example.

H3_GETRESOLUTION(h3_index)

Returns the resolution of the H3 index h3_index.

H3_GRIDDISK(h3_index, k)

Returns an array of H3 indexes within a given distance k from the provided H3 index h3_index.

H3_GRIDDISKN(h3_index, k, i)

Returns the i th H3 index within a given distance k from the provided H3 index h3_index. This function would typically be used in conjunction with H3_NUMGRIDDISK via iter-join. The value of i should be between 0 and the result of H3_NUMGRIDDISK(h3_index, k) - 1.

H3_GRIDRING(h3_index, k)

Returns an array of H3 indexes comprising a hollow ring at a distance k from the provided H3 index h3_index.

H3_H3TOSTRING(h3_index)

Returns the string representation of the H3 index h3_index.
This function is the inverse of H3_STRINGTOH3.

H3_ISVALID(h3_index)

Returns 1 (true) if the given H3 index h3_index is a valid H3 index value; otherwise returns 0 (false).

H3_LATLNGTOCELL (latitude, longitude, res)

Returns the H3 index, similar to a geohash, for the cell containing the latitude and longitude coordinate, with the given resolution res. The higher the resolution, the more precise the index is. The resolution res must be an integer between 0 and 15.Equivalent to H3_XYTOCELL(longitude, latitude, res).

H3_NUMGRIDDISK(h3_index, k)

Returns the number of cells at a distance of k from the provided H3 index h3_index. This function would typically be used in conjunction with H3_GRIDDISKN via iter-join.

H3_NUMPOLYGONTOCELLS(geom, res)

Returns the number of cells at the given resolution res that are within the given geometry geom. Only polygon geometries are supported. This function would typically be used in conjunction with H3_POLYGONTOCELLSN via iter-join.

H3_POLYGONTOCELLS(geom, res)

Returns an array of H3 indexes at the given resolution res that are within the given geometry geom. Only polygon geometries are supported.

H3_POLYGONTOCELLSN(geom, res, i)

Returns the i th H3 index at the given resolution res that is within the given geometry geom. Only polygon geometries are supported. This function would typically be used in conjunction with H3_NUMPOLYGONTOCELLS via iter-join. The value of i should be between 0 and the value returned from H3_NUMPOLYGONTOCELLS(geom, res) - 1.

H3_STRINGTOH3(h3_string)

Returns the H3 index corresponding to the string representation h3_string.
This function is the inverse of H3_H3TOSTRING.

H3_XYTOCELL(x, y, res)

Returns the H3 index, similar to a geohash, for the cell containing the x and y coordinate, with the given resolution res. The higher the resolution, the more precise the index is. The resolution res must be an integer between 0 and 15.Equivalent to H3_LATLNGTOCELL(y, x, res).See Geohash-H3 for an example.