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

# Geospatial functions

> SQL geospatial and H3 functions for working with location data - points, coordinates, polygons, and spatial indexes.

<Note>
  These functions aren't in the updated function reference yet. The details below come from the previous docs, and the product team is confirming them.
</Note>

Geospatial functions allow working with location-based data, including points, coordinates, polygons, and spatial indexes. They enable conversion, querying, and analysis of geographic information

### **H3 Functions**

#### H3\_LATLNG\_TO\_CELL

Converts latitude/longitude into an H3 cell index (INT).

```
H3_LATLNG_TO_CELL(lat, lng, res)
```

#### H3\_LATLNG\_TO\_CELLADDRESS

Converts lat/lng into an H3 cell address (STRING).

```
H3_LATLNG_TO_CELLADDRESS(lat, lng, res)
```

#### H3\_CELL\_TO\_PARENT

Gets the parent cell index for a given cell.

```
H3_CELL_TO_PARENT(cell, parent_res)
```

#### H3\_CELLADDRESS\_TO\_PARENT

Gets the parent cell address for a given cell address.

```
H3_CELLADDRESS_TO_PARENT(cell_address, parent_res)
```

#### H3\_CELL\_TO\_CELLADDRESS

Converts an H3 numeric cell index to its alphanumeric cell address.

```
H3_CELL_TO_CELLADDRESS(cell_index)
```

#### H3\_CELLADDRESS\_TO\_CELL

Converts H3 cell address back to numeric index.

```
H3_CELLADDRESS_TO_CELL(cell_address)
```

#### H3\_CELL\_TO\_LATLNG

Returns the lat/lng center of a cell as an array \[lat, lng].

```
H3_CELL_TO_LATLNG(cell_index)
```

#### H3\_CELLADDRESS\_TO\_LATLNG

Returns the lat/lng center of a cell address.

```
H3_CELLADDRESS_TO_LATLNG(cell_address)
```

#### H3\_CELL\_TO\_BOUNDARY\_AS\_GEOJSON

Returns the cell boundary as a GeoJSON polygon.

```
H3_CELL_TO_BOUNDARY_AS_GEOJSON(cell)
```

#### H3\_POINT\_TO\_CELL

Converts an ST\_POINT geometry to an H3 index.<br />

```
H3_POINT_TO_CELL(point, res)
```

#### H3\_POINT\_TO\_CELLADDRESS

Converts an ST\_POINT geometry to an H3 cell address.

```
H3_POINT_TO_CELLADDRESS(point, res)
```

#### H3\_POLYGON\_TO\_CELLS

Returns list of H3 cell indices covering a GeoJSON polygon.

```
H3_POLYGON_TO_CELLS(geojson, res)
```

#### H3\_POLYGON\_TO\_CELLADDRESSES

Returns list of H3 cell addresses covering a GeoJSON polygon.

```
H3_POLYGON_TO_CELLADDRESSES(geojson, res)
```

#### H3\_GRID\_DISK

Returns neighboring cells within hex distance *k*.

```
H3_GRID_DISK(cell, k)
```

### **Bing Tile Functions**

#### BING\_TILE\_AT

Returns the Bing tile ID at the given location and zoom level.

```
BING_TILE_AT(lat, lng, level)
```

#### BING\_TILE\_QUADKEY

Converts a Bing tile ID to its QuadKey representation.

```
BING_TILE_QUADKEY(tile_id)
```

### **ST Functions**

#### ST\_POINT

Creates a GEOGRAPHY point (lng, lat).

```
ST_POINT(lng, lat)
```

#### ST\_CONTAINS

Checks whether one geography fully contains another.

```
ST_CONTAINS(geogA, geogB)
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.