title_wip

Lists all the [H3](#h3-index) hexagons in the raduis of `k` from the given hexagon in random order.

**Syntax**

```
h3kRing(h3index, k)
```

**Arguments**

- `h3index` — Hexagon index number. [UInt64](/docs/sql-reference/data-types/int-uint).
- `k` — Radius. [integer](/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 arrayJoin(h3kRing(644325529233966508, 1)) AS h3index;
```

Result:

```
┌────────────h3index─┐
│ 644325529233966508 │
│ 644325529233966497 │
│ 644325529233966510 │
│ 644325529233966504 │
│ 644325529233966509 │
│ 644325529233966355 │
│ 644325529233966354 │
└────────────────────┘
```

## h3PolygonToCells[​](#h3polygontocells "Direct link to h3PolygonToCells")

Returns the hexagons (at specified resolution) contained by the provided geometry, either ring or (multi-)polygon.

**Syntax**

```
h3PolygonToCells(geometry, resolution)
```

**Arguments**

- `geometry` can be one of the following [Geo Data Types](/docs/sql-reference/data-types/geo) or their underlying primitive types:
  - [Ring](/docs/sql-reference/data-types/geo#ring)
  - [Polygon](/docs/sql-reference/data-types/geo#polygon)
  - [MultiPolygon](/docs/sql-reference/data-types/geo#multipolygon)
- `resolution` — Index resolution. Range: `[0, 15]`. [UInt8](/docs/sql-reference/data-types/int-uint).

**Returned values**

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

**Example**

Query:

```
SELECT h3PolygonToCells([(-122.4089866999972145,37.813318999983238),(-122.3544736999993603,37.7198061999978478),(-122.4798767000009008,37.8151571999998453)], 7) AS h3index;
```

Result:

```
┌────────────h3index─┐
│ 608692970769612799 │
│ 608692971927240703 │
│ 608692970585063423 │
│ 608692970819944447 │
│ 608692970719281151 │
│ 608692970752835583 │
│ 608692972027903999 │
└────────────────────┘
```

## h3GetBaseCell[​](#h3getbasecell "Direct link to h3GetBaseCell")

Returns the base cell number of the [H3](#h3-index) index.

**Syntax**

```
h3GetBaseCell(index)
```

**Parameter**

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

**Returned value**

- Hexagon base cell number. [UInt8](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
SELECT h3GetBaseCell(612916788725809151) AS basecell;
```

Result:

```
┌─basecell─┐
│       12 │
└──────────┘
```

## h3HexAreaM2[​](#h3hexaream2 "Direct link to h3HexAreaM2")

Returns average hexagon area in square meters at the given resolution.

**Syntax**

```
h3HexAreaM2(resolution)
```

**Parameter**

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

**Returned value**

- Area in square meters. [Float64](/docs/sql-reference/data-types/float).

**Example**

Query:

```
SELECT h3HexAreaM2(13) AS area;
```

Result:

```
┌─area─┐
│ 43.9 │
└──────┘
```

## h3HexAreaKm2[​](#h3hexareakm2 "Direct link to h3HexAreaKm2")

Returns average hexagon area in square kilometers at the given resolution.

**Syntax**

```
h3HexAreaKm2(resolution)
```

**Parameter**

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

**Returned value**

- Area in square kilometers. [Float64](/docs/sql-reference/data-types/float).

**Example**

Query:

```
SELECT h3HexAreaKm2(13) AS area;
```

Result:

```
┌──────area─┐
│ 0.0000439 │
└───────────┘
```

## h3IndexesAreNeighbors[​](#h3indexesareneighbors "Direct link to h3IndexesAreNeighbors")

Returns whether or not the provided [H3](#h3-index) indexes are neighbors.

**Syntax**

```
h3IndexesAreNeighbors(index1, index2)
```

**Arguments**

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

**Returned value**

- `1` — Indexes are neighbours. [UInt8](/docs/sql-reference/data-types/int-uint).
- `0` — Indexes are not neighbours. [UInt8](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
SELECT h3IndexesAreNeighbors(617420388351344639, 617420388352655359) AS n;
```

Result:

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

## h3ToChildren[​](#h3tochildren "Direct link to h3ToChildren")

Returns an array of child indexes for the given [H3](#h3-index) index.

**Syntax**

```
h3ToChildren(index, resolution)
```

**Arguments**

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

**Returned values**

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

**Example**

Query:

```
SELECT h3ToChildren(599405990164561919, 6) AS children;
```

Result:

```
┌─children───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [603909588852408319,603909588986626047,603909589120843775,603909589255061503,603909589389279231,603909589523496959,603909589657714687] │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```

## h3ToParent[​](#h3toparent "Direct link to h3ToParent")

Returns the parent (coarser) index containing the given [H3](#h3-index) index.

**Syntax**

```
h3ToParent(index, resolution)
```

**Arguments**

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

**Returned value**

- Parent H3 index. [UInt64](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
SELECT h3ToParent(599405990164561919, 3) AS parent;
```

Result:

```
┌─────────────parent─┐
│ 590398848891879423 │
└────────────────────┘
```

## h3ToString[​](#h3tostring "Direct link to h3ToString")

Converts the `H3Index` representation of the index to the string representation.

```
h3ToString(index)
```

**Parameter**

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

**Returned value**

- String representation of the H3 index. [String](/docs/sql-reference/data-types/string).

**Example**

Query:

```
SELECT h3ToString(617420388352917503) AS h3_string;
```

Result:

```
┌─h3_string───────┐
│ 89184926cdbffff │
└─────────────────┘
```

## stringToH3[​](#stringtoh3 "Direct link to stringToH3")

Converts the string representation to the `H3Index` (UInt64) representation.

**Syntax**

```
stringToH3(index_str)
```

**Parameter**

- `index_str` — String representation of the H3 index. [String](/docs/sql-reference/data-types/string).

**Returned value**

- Hexagon index number. Returns 0 on error. [UInt64](/docs/sql-reference/data-types/int-uint).

**Example**

Query:

```
SELECT stringToH3('89184926cc3ffff') AS index;
```

Result:

```
┌──────────────index─┐
│ 617420388351344639 │
└────────────────────┘
```

## h3GetResolution[​](#h3getresolution-1 "Direct link to h3GetResolution")

Returns the resolution of the [H3](#h3-index) index.

**Syntax**

```
h3GetResolution(index)
```

**Parameter**

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

**Returned value**

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

**Example**

Query:

```
SELECT h3GetResolution(617420388352917503) AS res;
```

Result:

```
┌─res─┐
│   9 │
└─────┘
```

## h3IsResClassIII[​](#h3isresclassiii "Direct link to h3IsResClassIII")

Returns whether [H3](#h3-index) index has a resolution with Class III orientation.

**Syntax**

```
h3IsResClassIII(index)
```

**Parameter**

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

**Returned value**