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

# Geospatial Functions

> Geographic calculations: ST_GeoHash, ST_Distance, and more

## Geospatial functions

NQL includes Sedona-based geospatial functions for location data.

### ST\_SafePoint

Creates a point geometry from longitude and latitude.

```sql theme={null}
SELECT ST_SafePoint(longitude, latitude) AS location
FROM company_data."123"
```

### ST\_Circle

Creates a circular geometry around a point.

```sql theme={null}
SELECT ST_Circle(ST_SafePoint(longitude, latitude), radius_meters) AS area
FROM company_data."123"
```

### ST\_DistanceSphere

Calculates the distance between two points on a sphere (in meters).

```sql theme={null}
SELECT ST_DistanceSphere(point1, point2) AS distance_meters
FROM company_data."123"
```

### ST\_GeoHash

Converts a point to a geohash string.

```sql theme={null}
SELECT ST_GeoHash(ST_SafePoint(longitude, latitude), 6) AS geohash
FROM company_data."123"
```

### ST\_H3CellIDs

Returns H3 hexagon cell IDs covering a geometry.

```sql theme={null}
SELECT ST_H3CellIDs(geometry, resolution) AS h3_cells
FROM company_data."123"
```

### ST\_H3KRing

Returns neighboring H3 cells within k rings.

```sql theme={null}
SELECT ST_H3KRing(h3_cell, k) AS neighbors
FROM company_data."123"
```

***

## Related content

<CardGroup cols={2}>
  <Card title="Numeric Functions" icon="hashtag" href="/nql/functions/numeric-functions">
    Math and rounding
  </Card>

  <Card title="String Functions" icon="font" href="/nql/functions/string-functions">
    Text manipulation
  </Card>

  <Card title="All Functions" icon="function" href="/nql/functions/index">
    Browse all function categories
  </Card>

  <Card title="Location Data" icon="location-dot" href="/concepts/data-formats/location-data">
    Working with geographic data
  </Card>
</CardGroup>
