Distance between a trgeometry and a geometry / pose / spatiotemporal box / another trgeometry is computed on the materialised geometry — the reference shape rotated and translated according to the pose. Distance is exact at every shared timestamp; for sequence inputs an adaptive recursive bisection emits intermediate marks where the distance trajectory deviates from a straight line.
Return the temporal distance between two trgeometries
{geometry,trgeometry} <-> {geometry,trgeometry} → tfloat
tDistance({geometry,trgeometry}, {geometry,trgeometry}) → tfloat
SELECT round(maxValue(tDistance( trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(0 0), 0.0)@2001-01-01', trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(5 0), 0.0)@2001-01-01')), 6); -- 4 SELECT asText(tDistance( trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));[Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(0 0), 0.0)@2001-01-02]', trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));[Pose(Point(2 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]')); -- [1@2001-01-01 ..., 9@2001-01-02 ...]
The dispatcher covers every subtype combination — TINSTANT × TINSTANT, TINSTANT × TSEQUENCE asymmetric, TSEQUENCE × TSEQUENCE, TSEQUENCE × TSEQUENCESET, TSEQUENCESET × TSEQUENCESET. The adaptive sub-sampling kernel underlies every continuous combo; instant combos materialise once. Pure-translation segments converge at depth 0 (two endpoint marks); rotation-heavy segments emit up to 32 marks per inter-instant gap. The bound on the LINEAR-interpolated approximation between marks is 1e-3 by construction.
Return the smallest distance between two trgeometries over their shared time domain
{geometry,trgeometry,stbox} |=| {geometry,trgeometry,stbox} → float
nearestApproachDistance({geometry,trgeometry,stbox}, {geometry,trgeometry,stbox}) → float
SELECT trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));[Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]'
|=|
trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));[Pose(Point(50 0), 0.0)@2001-01-01, Pose(Point(50 0), 0.0)@2001-01-02]';
-- 39
The |=| operator can be used for nearest-neighbour searches against GiST or SP-GiST indexes (see the section called “Indexing”).
Return the instant at which the two arguments are at their smallest mutual distance
nearestApproachInstant({geometry,trgeometry}, {geometry,trgeometry}) → trgeometry
SELECT asText(nearestApproachInstant( trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));[Pose(Point(0 0), 0.0)@2001-01-01, Pose(Point(10 0), 0.0)@2001-01-02]', geometry 'Point(5 5)')); -- POLYGON((5 0,6 0,6 1,5 1,5 0));Pose(POINT(5 0),0)@2001-01-01 12:00:00+00
Return the line connecting the two arguments at their nearest approach
shortestLine({geometry,trgeometry}, {geometry,trgeometry}) → geometry
SELECT ST_AsText(shortestLine( trgeometry 'Polygon((0 0,1 0,1 1,0 1,0 0));Pose(Point(0 0), 0.0)@2001-01-01', geometry 'Point(10 0)')); -- LINESTRING(1 0,10 0)