> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_H3CellIDs

Cover the geometry by H3 cell IDs with the given resolution(level).
To understand the cell statistics please refer to [H3 Doc](https://h3geo.org/docs/core-library/restable)
H3 native fill functions doesn't guarantee full coverage on the shapes.

## Cover Polygon

When fullCover = false, for polygon sedona will use [polygonToCells](https://h3geo.org/docs/api/regions#polygontocells).
This can't guarantee full coverage but will guarantee no false positive.

When fullCover = true, sedona will add on extra traversal logic to guarantee full coverage on shapes.
This will lead to redundancy but can guarantee full coverage.

Choose the option according to your use case.

## Cover LineString

For the lineString, sedona will call gridPathCells([https://h3geo.org/docs/api/traversal#gridpathcells](https://h3geo.org/docs/api/traversal#gridpathcells)) per segment.
From H3's documentation

> This function may fail to find the line between two indexes, for example if they are very far apart. It may also fail when finding distances for indexes on opposite sides of a pentagon.

When the `gridPathCells` function throw error, Sedona implemented in-house approximate implementation to generate the shortest path, which can cover the corner cases.

Both functions can't guarantee full coverage. When the `fullCover = true`, we'll do extra cell traversal to guarantee full cover.
In worst case, sedona will use MBR to guarantee the full coverage.

If you seek to get the shortest path between cells, you can call this function with `fullCover = false`

## Signatures

```sql theme={"system"}
ST_H3CellIDs(geom: geometry, level: Int, fullCover: Boolean)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="level" type="Integer" required>
  The level value.
</ParamField>

<ParamField body="fullCover" type="Boolean" required>
  The full cover value.
</ParamField>

## Return type

<ResponseField type="Array<Long>">
  An array of H3 cell IDs as Long values.
</ResponseField>

## Example

```sql theme={"system"}
SELECT ST_H3CellIDs(ST_GeomFromText('LINESTRING(1 3 4, 5 6 7)'), 6, true)
```

```
+-------------------------------------------------------------+
|st_h3cellids(st_geomfromtext(LINESTRING(1 3 4, 5 6 7), 0), 6)|
+-------------------------------------------------------------+
|                                         [6055475394579005...|
+-------------------------------------------------------------+
```

<img src="https://mintcdn.com/wherobots/fqh3gPDE0J25Lra_/images/sql-functions/ST_H3CellIDs/ST_H3CellIDs.svg?fit=max&auto=format&n=fqh3gPDE0J25Lra_&q=85&s=04b8daf66dd2d08034691217162a2835" alt="ST_H3CellIDs" width="400" height="230" data-path="images/sql-functions/ST_H3CellIDs/ST_H3CellIDs.svg" />
