Alphabetical list of H3 geospatial functions

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

Function

Description

h3_boundaryasgeojson(h3CellIdExpr)

Returns the polygonal boundary of the input H3 cell in GeoJSON format.

h3_boundaryaswkb(h3CellIdExpr)

Returns the polygonal boundary of the input H3 cell in WKB format.

h3_boundaryaswkt(h3CellIdExpr)

Returns the polygonal boundary of the input H3 cell in WKT format.

h3_centerasgeojson(h3CellIdExpr)

Returns the center of the input H3 cell as a point in GeoJSON format.

h3_centeraswkb(h3CellIdExpr)

Returns the center of the input H3 cell as a point in WKB format.

h3_centeraswkt(h3CellIdExpr)

Returns the center of the input H3 cell as a point in WKT format.

h3_compact(h3CellIdsExpr)

Compacts the input set of H3 cell IDs as best as possible.

h3_coverash3(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as BIGINT) corresponding to the minimal set of hexagons or pentagons, of the specified resolution, that fully cover the input linear or areal geography.

h3_coverash3string(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as STRING) corresponding to the minimal set of hexagons or pentagons, of the specified resolution, that fully cover the input linear or areal geography.

h3_distance(h3CellId1Expr, h3CellId2Expr)

Returns the grid distance of the two input H3 cell IDs.

h3_h3tostring(h3CellIdExpr)

Converts the input H3 cell ID to its equivalent hexadecimal string representation.

h3_hexring(h3CellIdExpr, kExpr)

Returns an array of H3 cell IDs that form a hollow hexagonal ring centered at the origin H3 cell and that are at grid distance k from the origin H3 cell.

h3_ischildof(h3CellId1Expr, h3CellId2Expr)

Returns true if the first H3 cell ID is equal to or a child of the second H3 cell ID.

h3_ispentagon(h3CellIdExpr)

Returns true if the input BIGINT or hexadecimal STRING corresponds to a pentagonal H3 cell or not.

h3_isvalid(expr)

Returns true if the input BIGINT or STRING is a valid H3 cell ID.

h3_kring(h3CellIdExpr, kExpr)

Returns the H3 cell IDs that are within (grid) distance k of the origin cell ID.

h3_kringdistances(h3CellIdExpr, kExpr)

Returns all H3 cell IDs (represented as long integers or strings) within grid distance k from the origin H3 cell ID, along with their distance from the origin H3 cell ID.

h3_longlatash3(longitudeExpr, latitudeExpr, resolutionExpr)

Returns the H3 cell ID (as a BIGINT) corresponding to the provided longitude and latitude at the specified resolution.

h3_longlatash3string(longitudeExpr, latitudeExpr, resolutionExpr)

Returns the H3 cell ID (as a hexadecimal STRING) corresponding to the provided longitude and latitude at the specified resolution.

h3_maxchild(h3CellIdExpr, resolutionExpr)

Returns the child of maximum value of the input H3 cell at the specified resolution.

h3_minchild(h3CellIdExpr, resolutionExpr)

Returns the child of minimum value of the input H3 cell at the specified resolution.

h3_pointash3(geographyExpr, resolutionExpr)

Returns the H3 cell ID (as a BIGINT) corresponding to the provided point at the specified resolution.

h3_pointash3string(geographyExpr, resolutionExpr)

Returns the H3 cell ID (as a STRING) corresponding to the provided point at the specified resolution.

h3_polyfillash3(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as BIGINT) corresponding to hexagons or pentagons, of the specified resolution, that are contained by the input areal geography.

h3_polyfillash3string(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as STRING) corresponding to hexagons or pentagons, of the specified resolution, that are contained by the input areal geography.

h3_resolution(h3CellIdExpr)

Returns the resolution of the input H3 cell ID.

h3_stringtoh3(h3CellIdStringExpr)

Converts the input string, which is expected to be a hexadecimal string representing an H3 cell ID, to the corresponding BIGINT representation of the H3 cell ID.

h3_tessellateaswkb(geographyExpr, resolutionExpr)

Returns a tessellation of the input geography using H3 cells at the specified resolution.

h3_tochildren(h3CellIdExpr, resolutionExpr)

Returns an array of the children H3 cell IDs of the input H3 cell ID at the specified resolution.

h3_toparent(h3CellIdExpr, resolutionExpr)

Returns the parent H3 cell ID of the input H3 cell ID at the specified resolution.

h3_try_distance(h3CellId1Expr, h3CellId2Expr)

Returns the grid distance of the two input H3 cell IDs of the same resolution, or NULL if the distance is undefined.

h3_try_polyfillash3(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as BIGINT) corresponding to hexagons or pentagons, of the specified resolution, that are contained by the input areal geography.

h3_try_polyfillash3string(geographyExpr, resolutionExpr)

Returns an ARRAY of H3 cell IDs (represented as STRING) corresponding to hexagons or pentagons, of the specified resolution, that are contained by the input areal geography.

h3_try_validate(h3CellIdExpr)

Returns the input value, that is of type BIGINT or STRING, if it corresponds to a valid H3 cell ID, or NULL otherwise.

h3_uncompact(h3CellIdsExpr, resolutionExpr)

Uncompacts the input set of H3 cell IDs to the specified resolution.

h3_validate(h3CellIdExpr)

Returns the input value, that is of type BIGINT or STRING, if it corresponds to a valid H3 cell ID, or emits an error otherwise.