Geospatial
Measure distances and evaluate spatial predicates over geometries (points, polygons, and multipolygons).
Scalar Functions
| Function | Summary |
|---|---|
spql.st.box | Construct an axis-aligned rectangle geometry from bounds. |
spql.st.contains | Whether the first geometry contains the second: the second lies in the first with at least one interior point in common. |
spql.st.distance | Planar (Euclidean) distance between two geometries (points, polygons, or multipolygons). |
spql.st.dwithin | Whether two geometries are within distance of each other. Lowers to st_distance(a, b) <= distance. |
spql.st.from_wkt | Construct a geometry from a Well-Known Text (WKT) string. |
spql.st.intersects | Whether two geometries intersect: they share at least one point, boundary contact included. |
spql.st.within | Whether the first geometry lies within the second: the inverse of ST_Contains. |
spql.st.x | The X (longitude) coordinate of a point. |
spql.st.xmax | The maximum X coordinate of a bounding box. |
spql.st.xmin | The minimum X coordinate of a bounding box. |
spql.st.y | The Y (latitude) coordinate of a point. |
spql.st.ymax | The maximum Y coordinate of a bounding box. |
spql.st.ymin | The minimum Y coordinate of a bounding box. |
spql.st.box
Construct an axis-aligned rectangle geometry from bounds.
SQL: ST_MakeEnvelope, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.box(xmin, ymin, xmax, ymax) -> inferredThe result type and nullability are inferred from the argument types when the call is bound.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
xmin | yes | f64 | Minimum X coordinate. |
ymin | yes | f64 | Minimum Y coordinate. |
xmax | yes | f64 | Maximum X coordinate. |
ymax | yes | f64 | Maximum Y coordinate. |
Returns
A rectangle geometry.
spql.st.contains
Whether the first geometry contains the second: the second lies in the first with at least one interior point in common.
SQL: ST_Contains, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.contains(a, b) -> bool?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
a | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | The containing geometry. |
b | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | The contained geometry. |
Returns
A boolean.
spql.st.distance
Planar (Euclidean) distance between two geometries (points, polygons, or multipolygons).
SQL: ST_Distance, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.distance(a, b) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
a | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | First geometry (point, polygon, or multipolygon). |
b | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | Second geometry (point, polygon, or multipolygon). |
Returns
A float distance.
spql.st.dwithin
Whether two geometries are within distance of each other. Lowers to st_distance(a, b) <= distance.
SQL: ST_DWithin, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.dwithin(a, b, distance) -> bool?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
a | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | First geometry (point, polygon, or multipolygon). |
b | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | Second geometry (point, polygon, or multipolygon). |
distance | yes | numeric | Maximum distance (any numeric type). |
Returns
A boolean.
spql.st.from_wkt
Construct a geometry from a Well-Known Text (WKT) string.
SQL: ST_GeomFromText, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.from_wkt(text) -> vortex.st.wkb?Nullable when an argument is nullable; otherwise non-nullable.
Returns WKB geometry without a coordinate reference system. Null text returns null; invalid WKT returns an error. Shared spatial predicates accept WKB literals, but do not yet accept WKB columns.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
text | yes | utf8 | Well-Known Text geometry string. |
Returns
A WKB geometry.
spql.st.intersects
Whether two geometries intersect: they share at least one point, boundary contact included.
SQL: ST_Intersects, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.intersects(a, b) -> bool?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
a | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | First geometry. |
b | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | Second geometry. |
Returns
A boolean.
spql.st.within
Whether the first geometry lies within the second: the inverse of ST_Contains.
SQL: ST_Within, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.within(a, b) -> bool?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
a | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | The contained geometry. |
b | yes | vortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkb | The containing geometry. |
Returns
A boolean.
spql.st.x
The X (longitude) coordinate of a point.
SQL: ST_X, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.x(point) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
point | yes | vortex.st.point | A point geometry. |
Returns
A float.
spql.st.xmax
The maximum X coordinate of a bounding box.
SQL: ST_XMax, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.xmax(box) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
box | yes | vortex.st.box | A bounding-box geometry. |
Returns
A double-precision float.
spql.st.xmin
The minimum X coordinate of a bounding box.
SQL: ST_XMin, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.xmin(box) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
box | yes | vortex.st.box | A bounding-box geometry. |
Returns
A double-precision float.
spql.st.y
The Y (latitude) coordinate of a point.
SQL: ST_Y, from SQL/MM Part 3
- Kind:
scalar function - Volatility:
immutable
spql.st.y(point) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
point | yes | vortex.st.point | A point geometry. |
Returns
A float.
spql.st.ymax
The maximum Y coordinate of a bounding box.
SQL: ST_YMax, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.ymax(box) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
box | yes | vortex.st.box | A bounding-box geometry. |
Returns
A double-precision float.
spql.st.ymin
The minimum Y coordinate of a bounding box.
SQL: ST_YMin, from PostGIS
- Kind:
scalar function - Volatility:
immutable
spql.st.ymin(box) -> f64?Nullable when an argument is nullable; otherwise non-nullable.
Parameters
| Name | Required | Type | Description |
|---|---|---|---|
box | yes | vortex.st.box | A bounding-box geometry. |
Returns
A double-precision float.