From 2721955f494575b7245c5880e2bc5b1dd297c3b8 Mon Sep 17 00:00:00 2001 From: bharatnc Date: Sat, 7 May 2022 23:14:08 -0700 Subject: [PATCH] docs for h3Distance --- docs/en/sql-reference/functions/geo/h3.md | 39 +++++++++++++++++++++++ 1 file changed, 39 insertions(+) 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)