Obtenir la trayectoria
trajectory(tpoint) → geo
Esta función es equivalente a getValues
para los valores temporales alphanuméricos
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)))
Obtener los valores de las coordenadas X/Y/Z como un número flotante temporal
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]
Obtener verdadero si el punto temporal no se auto-intersecta espacialmente
isSimple(tpoint) → boolean
Nótese que un punto temporal de conjunto de secuencias es simple si cada una de las secuencias que lo componen es 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
Obtener la longitud atravesada por el punto temporal
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
Obtener la longitud acumulada atravesada por el punto temporal
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]
Obtener la velocidad del punto temporal en unidades por segundo
speed(tpoint) → tfloatSeqSet
El punto temporal debe tener interpolación linear
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
Obtener el centroide ponderado en el tiempo
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)
Obtener la dirección, es decir, el acimut entre las ubicaciones inicial y final
direction(tpoint) → float
El resultado se expresa en radianes. Es NULL si solo hay una ubicación o si las ubicaciones inicial y final son iguales.
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
Obtener el acimut temporal
azimuth(tpoint) → tfloat
El resultado se expresa en radianes. El azimut es indefinido cuando dos localizaciones sucesivas son iguales y en este caso se añade una brecha de tempo.
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)}
Obtener la diferencia angular temporal
angularDifference(tpoint) → tfloat
El resultado se expresa en grados.
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}
Obtener el rumbo temporal
bearing({tpoint, point}, {tpoint, point}) → tfloat
Nótese que esta función no acepta dos puntos geográficos temporales.
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]