Return the instant of the first temporal network point at which the two arguments are at the nearest distance
nearestApproachInstant({geo,npoint,tpoint},{geo,npoint,tpoint}) → tpoint
SELECT nearestApproachInstant(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)'); -- NPoint(2,0.349928)@2001-01-01 02:59:44.402905+01 SELECT nearestApproachInstant(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', npoint 'NPoint(1, 0.5)'); -- NPoint(2,0.592181)@2001-01-01 17:31:51.080405+01
Return the smallest distance ever between the two arguments
nearestApproachDistance({geo,npoint,tpoint},{geo,npoint,tpoint}) → float
SELECT nearestApproachDistance(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)'); -- 1.41793220500979 SELECT nearestApproachDistance(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', npoint 'NPoint(1, 0.5)'); -- NPoint(2,0.592181)@2001-01-01 17:31:51.080405+01
Function nearestApproachDistance
has an associated operator |=|
that can be used for doing nearest neightbor searches using a GiST index (see the section called “Indexing”).
Return the line connecting the nearest approach point between the two arguments
shortestLine({geo,npoint,tpoint},{geo,npoint,tpoint}) → geometry
The function will only return the first line that it finds if there are more than one
SELECT ST_AsText(shortestLine(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', geometry 'Linestring(50 50,55 55)')); -- LINESTRING(50.7960725266492 48.8266286733015,50 50) SELECT ST_AsText(shortestLine(tnpoint '[NPoint(2, 0.3)@2001-01-01, NPoint(2, 0.7)@2001-01-02]', npoint 'NPoint(1, 0.5)')); -- LINESTRING(77.0902838115125 66.6659083092593,90.8134936900394 46.4385792121146)
Return the smallest distance ever between the two arguments
tgeompoint |=| tnpoint → float
SELECT tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03]' |=| npoint 'NPoint(1, 0.2)'; -- 2.34988300875063 SELECT tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03]' |=| geometry 'Linestring(2 2,2 1,3 1)'; -- 82.2059262761477
Return the temporal distance
tgeompoint <-> tnpoint → tfloat
SELECT tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03]' <-> npoint 'NPoint(1, 0.2)'; -- [2.34988300875063@2001-01-02 00:00:00+01, 2.34988300875063@2001-01-03 00:00:00+01] SELECT tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03]' <-> geometry 'Point(50 50)'; -- [25.0496666945044@2001-01-01 00:00:00+01, 26.4085688426232@2001-01-03 00:00:00+01] SELECT tnpoint '[NPoint(1, 0.3)@2001-01-01, NPoint(1, 0.5)@2001-01-03]' <-> tnpoint '[NPoint(1, 0.3)@2001-01-02, NPoint(1, 0.5)@2001-01-04]' -- [2.34988300875063@2001-01-02 00:00:00+01, 2.34988300875063@2001-01-03 00:00:00+01]