Return the smallest distance ever
{geo,cbuffer,tcbuffer,stbox} |=| {geo,cbuffer,tcbuffer,stbox} → float
The operator |=| that can be used for doing nearest neightbor searches using a GiST or an SP-GiST index (see the section called “Indexing”).
SELECT tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]' |=| geometry 'Linestring(50 50,55 55)'; -- 67.58225099390856 SELECT tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]' |=| cbuffer 'Cbuffer(Point(1 1), 0.5)'; -- 0.6142135623730951
Return the instant of the first temporal circular buffer at which the two arguments are at the nearest distance
nearestApproachInstant({geo,cbuffer,tcbuffer},{geo,cbuffer,tcbuffer}) → tcbuffer
SELECT nearestApproachInstant(tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)'); -- Cbuffer(POINT(2 2),0.349928)@2001-01-01 02:59:44.402905 SELECT nearestApproachInstant(tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]', cbuffer 'Cbuffer(Point(1 1), 0.5)'); -- Cbuffer(POINT(2 2),0.592181)@2001-01-01 17:31:51.080405
Return the line connecting the nearest approach point between the two arguments
shortestLine({geo,cbuffer,tcbuffer},{geo,cbuffer,tcbuffer}) → geometry
The function will only return the first line that it finds if there are more than one
SELECT ST_AsText(shortestLine(tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)')); -- LINESTRING(50 50,2.212132034355964 2.212132034355964) SELECT ST_AsText(shortestLine(tcbuffer '[Cbuffer(Point(2 2), 0.3)@2001-01-01, Cbuffer(Point(2 2), 0.7)@2001-01-02]', cbuffer 'Cbuffer(Point(1 1), 0.5)')); -- LINESTRING(1.353553390593274 1.353553390593274,1.787867965644036 1.787867965644036)
Return the temporal distance
{geo,cbuffer} <-> tcbuffer → tfloat
tcbuffer <-> {geo,cbuffer,tcbuffer} → tfloat
SELECT tcbuffer '[Cbuffer(Point(1 1), 0.3)@2001-01-01, Cbuffer(Point(1 1), 0.5)@2001-01-03]' <-> cbuffer 'Cbuffer(Point(1 1), 0.2)'; -- [0@2001-01-01, 0@2001-01-03] SELECT tcbuffer '[Cbuffer(Point(1 1), 0.3)@2001-01-01, Cbuffer(Point(1 1), 0.5)@2001-01-03]' <-> geometry 'Point(50 50)'; -- [68.99646455628167@2001-01-01, 68.79646455628166@2001-01-03] SELECT tcbuffer '[Cbuffer(Point(1 1), 0.3)@2001-01-01, Cbuffer(Point(1 1), 0.5)@2001-01-03]' <-> tcbuffer '[Cbuffer(Point(1 1), 0.3)@2001-01-02, Cbuffer(Point(1 1), 0.5)@2001-01-04]'; -- [0@2001-01-02, 0@2001-01-03]
Return the minimum spatial distance, ignoring time
minDistance({geometry,cbuffer,tcbuffer},{geometry,cbuffer,tcbuffer}) → float
The result is the spatial distance between the areas swept by the two arguments over their whole lifespans, equal to ST_Distance of the traversedArea of each. The form taking two temporal circular buffers is an aggregate so that a cross join grouped by a key yields the minimum over every pair in the group.
SELECT minDistance(tcbuffer '[Cbuffer(Point(0 0), 0.5)@2001-01-01, Cbuffer(Point(10 0), 0.5)@2001-01-02]', geometry 'Point(5 5)'); -- 4.5 SELECT minDistance(tcbuffer '[Cbuffer(Point(0 0), 0.5)@2001-01-01, Cbuffer(Point(10 0), 0.5)@2001-01-02]', cbuffer 'Cbuffer(Point(5 5), 1)'); -- 3.5 SELECT g, minDistance(t1.Noise, t2.Noise) FROM Vessel v1, VesselTrip t1, Vessel v2, VesselTrip t2 WHERE v1.MMSI = t1.MMSI AND v2.MMSI = t2.MMSI GROUP BY t1.ShipTypeLabel, t2.ShipTypeLabel;