Skip to main content

Geospatial functions

NQL includes Sedona-based geospatial functions for location data.

ST_SafePoint

Creates a point geometry from longitude and latitude.
SELECT ST_SafePoint(longitude, latitude) AS location
FROM company_data."123"

ST_Circle

Creates a circular geometry around a point.
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).
SELECT ST_DistanceSphere(point1, point2) AS distance_meters
FROM company_data."123"

ST_GeoHash

Converts a point to a geohash string.
SELECT ST_GeoHash(ST_SafePoint(longitude, latitude), 6) AS geohash
FROM company_data."123"

ST_H3CellIDs

Returns H3 hexagon cell IDs covering a geometry.
SELECT ST_H3CellIDs(geometry, resolution) AS h3_cells
FROM company_data."123"

ST_H3KRing

Returns neighboring H3 cells within k rings.
SELECT ST_H3KRing(h3_cell, k) AS neighbors
FROM company_data."123"