title_wip

**Example**

Query:

```
SELECT h3PointDistM(-10.0 ,0.0, 10.0, 0.0) AS h3PointDistM;
```

Result:

```
┌──────h3PointDistM─┐
│ 2223901.039504589 │
└───────────────────┘
```

## h3PointDistKm[​](#h3pointdistkm "Direct link to h3PointDistKm")

Returns the "great circle" or "haversine" distance between pairs of GeoCoord points (latitude/longitude) pairs in kilometers.

**Syntax**

```
h3PointDistKm(lat1, lon1, lat2, lon2)
```

**Arguments**

- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. [Float64](/docs/sql-reference/data-types/float).
- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. [Float64](/docs/sql-reference/data-types/float).

**Returned values**

- Haversine or great circle distance in kilometers. [Float64](/docs/sql-reference/data-types/float).

**Example**

Query:

```
SELECT h3PointDistKm(-10.0 ,0.0, 10.0, 0.0) AS h3PointDistKm;
```

Result:

```
┌─────h3PointDistKm─┐
│ 2223.901039504589 │
└───────────────────┘
```

## h3PointDistRads[​](#h3pointdistrads "Direct link to h3PointDistRads")

Returns the "great circle" or "haversine" distance between pairs of GeoCoord points (latitude/longitude) pairs in radians.

**Syntax**

```
h3PointDistRads(lat1, lon1, lat2, lon2)
```

**Arguments**

- `lat1`, `lon1` — Latitude and Longitude of point1 in degrees. [Float64](/docs/sql-reference/data-types/float).
- `lat2`, `lon2` — Latitude and Longitude of point2 in degrees. [Float64](/docs/sql-reference/data-types/float).

**Returned values**

- Haversine or great circle distance in radians. [Float64](/docs/sql-reference/data-types/float).

**Example**

Query:

```
SELECT h3PointDistRads(-10.0 ,0.0, 10.0, 0.0) AS h3PointDistRads;
```

Result:

```
┌────h3PointDistRads─┐
│ 0.3490658503988659 │
└────────────────────┘
```

## h3GetRes0Indexes[​](#h3getres0indexes "Direct link to h3GetRes0Indexes")

Returns an array of all the resolution 0 H3 indexes.

**Syntax**

```
h3GetRes0Indexes()
```

**Returned values**

- Array of all the resolution 0 H3 indexes. [Array](/docs/sql-reference/data-types/array)([UInt64](/docs/sql-reference/data-types/int-uint)).

**Example**

Query:

```
SELECT h3GetRes0Indexes AS indexes ;
```

Result:

```
┌─indexes─────────────────────────────────────┐
│ [576495936675512319,576531121047601151,....]│
└─────────────────────────────────────────────┘
```

## h3GetPentagonIndexes[​](#h3getpentagonindexes "Direct link to h3GetPentagonIndexes")

Returns all the pentagon H3 indexes at the specified resolution.

**Syntax**

```
h3GetPentagonIndexes(resolution)
```

**Parameter**

- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](/docs/sql-reference/data-types/int-uint).

**Returned value**

- Array of all pentagon H3 indexes. [Array](/docs/sql-reference/data-types/array)([UInt64](/docs/sql-reference/data-types/int-uint)).

**Example**

Query:

```
SELECT h3GetPentagonIndexes(3) AS indexes;
```

Result:

```
┌─indexes────────────────────────────────────────────────────────┐
│ [590112357393367039,590464201114255359,590816044835143679,...] │
└────────────────────────────────────────────────────────────────┘
```

## h3Line[​](#h3line "Direct link to h3Line")

Returns the line of indices between the two indices that are provided.

**Syntax**

```
h3Line(start,end)
```

**Parameter**

- `start` — Hexagon index number that represents a starting point. [UInt64](/docs/sql-reference/data-types/int-uint).
- `end` — Hexagon index number that represents an ending point. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned value**

Array of h3 indexes representing the line of indices between the two provided indices. [Array](/docs/sql-reference/data-types/array)([UInt64](/docs/sql-reference/data-types/int-uint)).

**Example**

Query:

```
 SELECT h3Line(590080540275638271,590103561300344831) AS indexes;
```

Result:

```
┌─indexes────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [590080540275638271,590080471556161535,590080883873021951,590106516237844479,590104385934065663,590103630019821567,590103561300344831] │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

## h3Distance[​](#h3distance "Direct link to h3Distance")

Returns the distance in grid cells between the two indices that are provided.

**Syntax**

```
h3Distance(start,end)
```

**Parameter**

- `start` — Hexagon index number that represents a starting point. [UInt64](/docs/sql-reference/data-types/int-uint).
- `end` — Hexagon index number that represents an ending point. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned value**

- Number of grid cells. [Int64](/docs/sql-reference/data-types/int-uint).

Returns a negative number if finding the distance fails.

**Example**

Query:

```
 SELECT h3Distance(590080540275638271,590103561300344831) AS distance;
```

Result:

```
┌─distance─┐
│        7 │
└──────────┘
```

## h3HexRing[​](#h3hexring "Direct link to h3HexRing")

Returns the indexes of the hexagonal ring centered at the provided origin h3Index and length k.

Returns 0 if no pentagonal distortion was encountered.

**Syntax**

```
h3HexRing(index, k)
```

**Parameter**

- `index` — Hexagon index number that represents the origin. [UInt64](/docs/sql-reference/data-types/int-uint).
- `k` — Distance. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned values**

- Array of H3 indexes. [Array](/docs/sql-reference/data-types/array)([UInt64](/docs/sql-reference/data-types/int-uint)).

**Example**

Query:

```
 SELECT h3HexRing(590080540275638271, toUInt16(1)) AS hexRing;
```

Result:

```
┌─hexRing─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [590080815153545215,590080471556161535,590080677714591743,590077585338138623,590077447899185151,590079509483487231] │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

## h3GetUnidirectionalEdge[​](#h3getunidirectionaledge "Direct link to h3GetUnidirectionalEdge")

Returns a unidirectional edge H3 index based on the provided origin and destination and returns 0 on error.

**Syntax**

```
h3GetUnidirectionalEdge(originIndex, destinationIndex)
```

**Parameter**

- `originIndex` — Origin Hexagon index number. [UInt64](/docs/sql-reference/data-types/int-uint).
- `destinationIndex` — Destination Hexagon index number. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned value**

- Unidirectional Edge Hexagon Index number. [UInt64](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
 SELECT h3GetUnidirectionalEdge(599686042433355775, 599686043507097599) AS edge;
```

Result:

```
┌────────────────edge─┐
│ 1248204388774707199 │
└─────────────────────┘
```

## h3UnidirectionalEdgeIsValid[​](#h3unidirectionaledgeisvalid "Direct link to h3UnidirectionalEdgeIsValid")

Determines if the provided H3Index is a valid unidirectional edge index. Returns 1 if it's a unidirectional edge and 0 otherwise.

**Syntax**

```
h3UnidirectionalEdgeisValid(index)
```

**Parameter**

- `index` — Hexagon index number. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned value**

- 1 — The H3 index is a valid unidirectional edge. [UInt8](/docs/sql-reference/data-types/int-uint).
- 0 — The H3 index is not a valid unidirectional edge. [UInt8](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
 SELECT h3UnidirectionalEdgeIsValid(1248204388774707199) AS validOrNot;
```

Result:

```
┌─validOrNot─┐
│          1 │
└────────────┘
```

## h3GetOriginIndexFromUnidirectionalEdge[​](#h3getoriginindexfromunidirectionaledge "Direct link to h3GetOriginIndexFromUnidirectionalEdge")

Returns the origin hexagon index from the unidirectional edge H3Index.

**Syntax**

```
h3GetOriginIndexFromUnidirectionalEdge(edge)
```

**Parameter**

- `edge` — Hexagon index number that represents a unidirectional edge. [UInt64](/docs/sql-reference/data-types/int-uint).

**Returned value**

- Origin Hexagon Index number. [UInt64](/docs/sql-reference/data-types/int-uint).