diff --git a/docs/en/sql-reference/functions/geo/h3.md b/docs/en/sql-reference/functions/geo/h3.md index 6ccd6e201ac..fea6e865152 100644 --- a/docs/en/sql-reference/functions/geo/h3.md +++ b/docs/en/sql-reference/functions/geo/h3.md @@ -1064,4 +1064,43 @@ Result: └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ``` +## h3Distance {#h3distance} + +Returns the distance in grid cells between the two indices that are provided. + +**Syntax** + +``` sql +h3Distance(start,end) +``` + +**Parameter** + +- `start` — Hexagon index number that represents a starting point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md). +- `end` — Hexagon index number that represents an ending point. Type: [UInt64](../../../sql-reference/data-types/int-uint.md). + +**Returned value** + +- Number of grid cells. + +Type: [Int64](../../../sql-reference/data-types/int-uint.md). + +Returns a negative number if finding the distance fails. + +**Example** + +Query: + +``` sql + SELECT h3Distance(590080540275638271,590103561300344831) as distance; +``` + +Result: + +``` text +┌─distance─┐ +│ 7 │ +└──────────┘ +``` + [Original article](https://clickhouse.com/docs/en/sql-reference/functions/geo/h3)