ST_trajectoryTemporal
Updated at:
Returns a JSON object containing the ordered list of timestamps at each vertex of a trajectory object. The alias ST_trajTemporal is equivalent.
Syntax
text ST_trajectoryTemporal(trajectory traj);
text ST_trajTemporal(trajectory traj);Return value: text containing a JSON object of the form {"timeline": [...]}, where each element is a timestamp corresponding to a vertex in the trajectory.
Parameters
| Parameter | Description |
|---|---|
traj | The trajectory object. |
Example
The following example constructs a trajectory from a three-point LINESTRING and retrieves its timeline. The output contains one timestamp per vertex.
SELECT ST_trajectoryTemporal(
ST_MakeTrajectory(
'STPOINT'::leaftype,
st_geomfromtext('LINESTRING (114 35, 115 36, 116 37)', 4326),
'[2010-01-01 14:30, 2010-01-01 15:30)'::tsrange,
null
)
);Output:
st_trajectorytemporal
--------------------------------------------------------------------------------
{"timeline":["2010-01-01 14:30:00","2010-01-01 15:00:00","2010-01-01 15:30:00"]}
(1 row)Related functions
ST_trajectorySpatial— returns the spatial component of a trajectory objectST_trajectoryAttributes— returns the attribute component of a trajectory objectST_MakeTrajectory— constructs a trajectory object
Is this page helpful?