> ## 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_H3CellDistance

return result of h3 function [gridDistance(cel1, cell2)](https://h3geo.org/docs/api/traversal#griddistance).
As described by H3 documentation

> Finding the distance can fail because the two indexes are not comparable (different resolutions), too far apart, or are separated by pentagonal distortion. This is the same set of limitations as the local IJ coordinate space functions.

In this case, Sedona use in-house implementation of estimation the shortest path and return the size as distance.

## Signatures

```sql theme={"system"}
ST_H3CellDistance(cell1: Long, cell2: Long)
```

## Parameters

<ParamField body="cell1" type="Long" required>
  The cell1 value.
</ParamField>

<ParamField body="cell2" type="Long" required>
  The cell2 value.
</ParamField>

## Return type

<ResponseField type="Long">
  An integer value.
</ResponseField>

## Example

```sql theme={"system"}
select ST_H3CellDistance(ST_H3CellIDs(ST_GeomFromWKT('POINT(1 2)'), 8, true)[0], ST_H3CellIDs(ST_GeomFromWKT('POINT(1.23 1.59)'), 8, true)[0])
```

```
+-----------------------------------------------------------------------------------------------------------------------------------------+
|st_h3celldistance(st_h3cellids(st_geomfromwkt(POINT(1 2), 0), 8, true)[0], st_h3cellids(st_geomfromwkt(POINT(1.23 1.59), 0), 8, true)[0])|
+-----------------------------------------------------------------------------------------------------------------------------------------+
|                                                                                                                                       78|
+-----------------------------------------------------------------------------------------------------------------------------------------+
```

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