跳转至
🎉 SedonaDB 0.4.0 已正式发布!🗺️ 新增 Python DataFrame API、R dplyr 接口、Geography 支持及 GPU 加速空间连接。阅读发布博客 →

ST_H3CellDistance

Introduction: return result of h3 function gridDistance(cel1, cell2). As described by H3 documentation

Finding the distance can fail because the two indexes are not comparable (different resolutions), too far apart, or are separated by pentagonal distortion. This is the same set of limitations as the local IJ coordinate space functions.

In this case, Sedona use in-house implementation of estimation the shortest path and return the size as distance.

Format: ST_H3CellDistance(cell1: Long, cell2: Long)

Return type: Long

Since: v1.5.0

Example:

select ST_H3CellDistance(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[1], ST_H3CellIDs(ST_GeomFromWKT('POINT(1.23 1.59)'), 8, true)[1])

Output:

+----+----------------------+
| op |               EXPR$0 |
+----+----------------------+
| +I |                   78 |
+----+----------------------+

ST_H3CellDistance