The following are the built-in measure (i.e. length/distance/area/relation) operators available in the MSQL language.
@ (x: int64) -> int64
@ (x: float64) -> float64
@(g: [multi]linestring) -> float64
@(g: [multi]polygon) -> float64
@(r: intXrange) -> int64
@(r: floatXrange) -> float64
@(r: timerange) -> timeperiod
In case of a numeric operand, it's an alias for the ABS function; in case of range operand, an alias for RSPAN function; in case of a spatial operand, an alias for ST_LENGTH function.
Return type
Otherwise result is an int64 for integer/integral-range arguments, float64 for floating/floating-range/spatial arguments, and timeperiod for time ranges (rtimestamp and runixepoch).
Null handling
If the operand is NULL, the result will also be NULL.
Examples
SELECT @10;
--> 10
SELECT @-2.5;
--> 2.5
SELECT @RANGE(10, 40);
--> 30
SELECT @RANGE(40, 10);
--> -30
SELECT @linestring '(0 0, 1000 1000, 2000 0)';
--> 421.587802
See also
@@(r: intXrange) -> int64
@@(r: floatXrange) -> float64
@@(r: timerange) -> timeperiod
@@(g: [multi]polygon) -> float64
Returns the absolute span of a range. In case of spatial operand, an alias for ST_AREA function.
Null handling
If the operand is NULL, the result will also be NULL.
Notes
In the case of a range operand, @@r is equivalent to ABS(RSPAN(r)).
Examples
SELECT @@RANGE(10, 40);
--> 30
SELECT @@RANGE(40, 10);
--> 30
SELECT @@polygon '((0 0, 100 0, 100 100, 0 100, 0 0))';
--> 222.17034400
See also
(g1: anygeometry) <-> (g2: anygeometry) -> float64
(r1: range[T]) <-> (r2: range[T]) -> T
In case of spatial operands, alias for ST_DISTANCE function. In case of range operands, alias for RDISTANCE function.
Null handling
If any of the spatial operands is empty (e.g. LINESTRING EMPTY), the result will be NULL.
Examples
SELECT point '(11916983 38520414)' <-> point '(12258696 36101539)';
--> 258938.47
SELECT RANGE(0, 10) <-> RANGE(30, 40);
--> 20
SELECT RANGE(40, 20) <-> RANGE(-10, -30);
--> -30
SELECT RANGE(0, 20) <-> RANGE(10, 30);
--> 0
See also
(g1: anygeometry) > (g2: anygeometry) -> text
Alias for the ST_RELATION function.
Null handling
If any of the operands is NULL, the result will also be NULL.
Examples
SELECT linestring '(10 20, 30 40)' <?> linestring '(50 60, 70 80)';
--> 'FF1FF0102'