ReferenceSPQL

Geospatial

Measure distances and evaluate spatial predicates over geometries (points, polygons, and multipolygons).

Scalar Functions

FunctionSummary
spql.st.boxConstruct an axis-aligned rectangle geometry from bounds.
spql.st.containsWhether the first geometry contains the second: the second lies in the first with at least one interior point in common.
spql.st.distancePlanar (Euclidean) distance between two geometries (points, polygons, or multipolygons).
spql.st.dwithinWhether two geometries are within distance of each other. Lowers to st_distance(a, b) <= distance.
spql.st.from_wktConstruct a geometry from a Well-Known Text (WKT) string.
spql.st.intersectsWhether two geometries intersect: they share at least one point, boundary contact included.
spql.st.withinWhether the first geometry lies within the second: the inverse of ST_Contains.
spql.st.xThe X (longitude) coordinate of a point.
spql.st.xmaxThe maximum X coordinate of a bounding box.
spql.st.xminThe minimum X coordinate of a bounding box.
spql.st.yThe Y (latitude) coordinate of a point.
spql.st.ymaxThe maximum Y coordinate of a bounding box.
spql.st.yminThe 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) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

Parameters

NameRequiredTypeDescription
xminyesf64Minimum X coordinate.
yminyesf64Minimum Y coordinate.
xmaxyesf64Maximum X coordinate.
ymaxyesf64Maximum 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

NameRequiredTypeDescription
ayesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbThe containing geometry.
byesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbThe 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

NameRequiredTypeDescription
ayesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbFirst geometry (point, polygon, or multipolygon).
byesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbSecond 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

NameRequiredTypeDescription
ayesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbFirst geometry (point, polygon, or multipolygon).
byesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbSecond geometry (point, polygon, or multipolygon).
distanceyesnumericMaximum 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

NameRequiredTypeDescription
textyesutf8Well-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

NameRequiredTypeDescription
ayesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbFirst geometry.
byesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbSecond 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

NameRequiredTypeDescription
ayesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbThe contained geometry.
byesvortex.st.point | vortex.st.polygon | vortex.st.multipolygon | vortex.st.box | vortex.st.wkbThe 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

NameRequiredTypeDescription
pointyesvortex.st.pointA 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

NameRequiredTypeDescription
boxyesvortex.st.boxA 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

NameRequiredTypeDescription
boxyesvortex.st.boxA 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

NameRequiredTypeDescription
pointyesvortex.st.pointA 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

NameRequiredTypeDescription
boxyesvortex.st.boxA 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

NameRequiredTypeDescription
boxyesvortex.st.boxA bounding-box geometry.

Returns

A double-precision float.

Found a problem? Edit this page or report an issue.

On this page