Return the trajectory
trajectory(tpoint) → geo
This function is equivalent to getValues
for temporal alphanumeric values
SELECT ST_AsText(trajectory(tgeompoint '{[Point(0 0)@2001-01-01, Point(0 1)@2001-01-02), [Point(0 1)@2001-01-03, Point(1 1)@2001-01-04)}')); -- MULTILINESTRING((0 0,0 1),(0 1,1 1)) SELECT ST_AsText(trajectory(tgeompoint 'Interp=Step;{[Point(0 0)@2001-01-01, Point(0 1)@2001-01-02], [Point(0 1)@2001-01-03, Point(1 1)@2001-01-04]}')); -- MULTIPOINT((0 0),(0 1),(0 1),(1 1)) SELECT ST_AsText(trajectory(tgeompoint '{Point(0 0)@2001-01-01, Point(0 1)@2001-01-02}')); -- MULTIPOINT((0 0),(0 1)) SELECT ST_AsText(trajectory(tgeompoint '{[Point(0 0)@2001-01-01, Point(0 1)@2001-01-02), [Point(1 1)@2001-01-03, Point(1 1)@2001-01-04), [Point(2 1)@2001-01-05, Point(2 2)@2001-01-06)}')); -- GEOMETRYCOLLECTION(POINT(1 1),MULTILINESTRING((0 0,0 1),(2 1,2 2)))
Return the X/Y/Z coordinate values as a temporal float
getX(tpoint) → tfloat
getY(tpoint) → tfloat
getZ(tpoint) → tfloat
SELECT getX(tgeompoint '{Point(1 2)@2001-01-01, Point(3 4)@2001-01-02, Point(5 6)@2001-01-03}'); -- {1@2001-01-01, 3@2001-01-02, 5@2001-01-03} SELECT getX(tgeogpoint 'Interp=Step;[Point(1 2 3)@2001-01-01, Point(4 5 6)@2001-01-02, Point(7 8 9)@2001-01-03]'); -- Interp=Step;[1@2001-01-01, 4@2001-01-02, 7@2001-01-03] SELECT getY(tgeompoint '{Point(1 2)@2001-01-01, Point(3 4)@2001-01-02, Point(5 6)@2001-01-03}'); -- {2@2001-01-01, 4@2001-01-02, 6@2001-01-03} SELECT getY(tgeogpoint 'Interp=Step;[Point(1 2 3)@2001-01-01, Point(4 5 6)@2001-01-02, Point(7 8 9)@2001-01-03]'); -- Interp=Step;[2@2001-01-01, 5@2001-01-02, 8@2001-01-03] SELECT getZ(tgeompoint '{Point(1 2)@2001-01-01, Point(3 4)@2001-01-02, Point(5 6)@2001-01-03}'); -- The temporal point must have Z dimension SELECT getZ(tgeogpoint 'Interp=Step;[Point(1 2 3)@2001-01-01, Point(4 5 6)@2001-01-02, Point(7 8 9)@2001-01-03]'); -- Interp=Step;[3@2001-01-01, 6@2001-01-02, 9@2001-01-03]
Return true if the temporal point does not spatially self-intersect
isSimple(tpoint) → boolean
Notice that a temporal sequence set point is simple if every composing sequence is simple.
SELECT isSimple(tgeompoint '[Point(0 0)@2001-01-01, Point(1 1)@2001-01-02, Point(0 0)@2001-01-03]'); -- false SELECT isSimple(tgeompoint '[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02, Point(2 0 2)@2001-01-03, Point(0 0 0)@2001-01-04]'); -- false SELECT isSimple(tgeompoint '{[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02], [Point(1 1 1)@2001-01-03, Point(0 0 0)@2001-01-04]}'); -- true
Return the length traversed by the temporal point
length(tpoint) → float
SELECT length(tgeompoint '[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02]'); -- 1.73205080756888 SELECT length(tgeompoint '[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02, Point(0 0 0)@2001-01-03]'); -- 3.46410161513775 SELECT length(tgeompoint 'Interp=Step;[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02, Point(0 0 0)@2001-01-03]'); -- 0
Return the cumulative length traversed by the temporal point
cumulativeLength(tpoint) → tfloatSeq
SELECT round(cumulativeLength(tgeompoint '{[Point(0 0)@2001-01-01, Point(1 1)@2001-01-02, Point(1 0)@2001-01-03], [Point(1 0)@2001-01-04, Point(0 0)@2001-01-05]}'), 6); -- {[0@2001-01-01, 1.414214@2001-01-02, 2.414214@2001-01-03], [2.414214@2001-01-04, 3.414214@2001-01-05]} SELECT cumulativeLength(tgeompoint 'Interp=Step;[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02, Point(0 0 0)@2001-01-03]'); -- Interp=Step;[0@2001-01-01, 0@2001-01-03]
Return the speed of the temporal point in units per second
speed(tpoint) → tfloatSeqSet
The temporal point must have linear interpolation
SELECT speed(tgeompoint '{[Point(0 0)@2001-01-01, Point(1 1)@2001-01-02, Point(1 0)@2001-01-03], [Point(1 0)@2001-01-04, Point(0 0)@2001-01-05]}') * 3600 * 24; /* Interp=Step;{[1.4142135623731@2001-01-01, 1@2001-01-02, 1@2001-01-03], [1@2001-01-04, 1@2001-01-05]} */ SELECT speed(tgeompoint 'Interp=Step;[Point(0 0)@2001-01-01, Point(1 1)@2001-01-02, Point(1 0)@2001-01-03]'); -- ERROR: The temporal value must have linear interpolation
Return the time-weighted centroid
twCentroid(tgeompoint) → point
SELECT ST_AsText(twCentroid(tgeompoint '{[Point(0 0 0)@2001-01-01, Point(0 1 1)@2001-01-02, Point(0 1 1)@2001-01-03, Point(0 0 0)@2001-01-04)}')); -- POINT Z (0 0.666666666666667 0.666666666666667)
Return the direction, that is, the azimuth between the start and end locations
direction(tpoint) → float
The result is expressed in radians. It is NULL if there is only one location or if the start and end locations are equal.
SELECT round(degrees(direction(tgeompoint '[Point(0 0)@2001-01-01, Point(-1 -1)@2001-01-02, Point(1 1)@2001-01-03]'))::numeric, 6); -- 45.000000 SELECT direction(tgeompoint '{[Point(0 0 0)@2001-01-01, Point(0 1 1)@2001-01-02, Point(0 1 1)@2001-01-03, Point(0 0 0)@2001-01-04)}'); -- NULL
Return the temporal azimuth
azimuth(tpoint) → tfloat
The result is expressed in radians. The azimut is undefined when two succesive locations are equal and in this case a temporal gap is added.
SELECT round(degrees(azimuth(tgeompoint '[Point(0 0 0)@2001-01-01, Point(1 1 1)@2001-01-02, Point(1 1 1)@2001-01-03, Point(0 0 0)@2001-01-04)'))); -- Interp=Step;{[45@2001-01-01, 45@2001-01-02], [225@2001-01-03, 225@2001-01-04)}
Return the temporal angular difference
angularDifference(tpoint) → tfloat
The result is expressed in degrees.
SELECT round(angularDifference(tgeompoint '[Point(1 1)@2001-01-01, Point(2 2)@2001-01-02, Point(1 1)@2001-01-03]'), 3); -- {0@2001-01-01, 180@2001-01-02, 0@2001-01-03} SELECT round(degrees(angularDifference(tgeompoint '{[Point(1 1)@2001-01-01, Point(2 2)@2001-01-02], [Point(2 2)@2001-01-03, Point(1 1)@2001-01-04]}')), 3); -- {0@2001-01-01, 0@2001-01-02, 0@2001-01-03, 0@2001-01-04}
Return the temporal bearing
bearing({tpoint, point}, {tpoint, point}) → tfloat
Notice that this function does not accept two temporal geographic points.
SELECT degrees(bearing(tgeompoint '[Point(1 1)@2001-01-01, Point(3 3)@2001-01-03]', geometry 'Point(2 2)')); -- [45@2001-01-01, 0@2001-01-02, 225@2001-01-03] SELECT round(degrees(bearing(tgeompoint '[Point(0 0)@2001-01-01, Point(2 0)@2001-01-03]', tgeompoint '[Point(2 1)@2001-01-01, Point(0 1)@2001-01-03]')), 3); -- [63.435@2001-01-01, 0@2001-01-02, 296.565@2001-01-03] SELECT round(degrees(bearing(tgeompoint '[Point(2 1)@2001-01-01, Point(0 1)@2001-01-03]', tgeompoint '[Point(0 0)@2001-01-01, Point(2 0)@2001-01-03]')), 3); -- [243.435@2001-01-01, 116.565@2001-01-03]