Removes drift points from a trajectory object based on speed, distance, and time interval thresholds.
Syntax
trajectory ST_removeDriftPoints(trajectory traj, float8 speed, float8 dist, interval offset);Parameters
| Parameter | Type | Description |
|---|---|---|
traj | trajectory | The trajectory object. |
speed | float8 | Speed threshold, in meters per second. |
dist | float8 | Distance threshold, in meters. |
offset | interval | Time interval threshold. |
Description
ST_removeDriftPoints removes trajectory points that meet all three of the following conditions and returns the updated trajectory object:
The speed at the trajectory point exceeds the
speedthreshold. Speed is calculated in real time based on position and time offset.The distance from the trajectory point to the previous trajectory point exceeds the
distthreshold.The time interval exceeds the
offsetthreshold.
The returned trajectory object always contains at least two trajectory points. If the input trajectory has exactly two points, no points are removed.
By default, the coordinate reference system is World Geodetic System 1984 (WGS 84). To use a different coordinate reference system, specify a spatial reference system identifier (SRID) when creating the trajectory object, or call ST_SetSRID to set the SRID afterward. Spherical distances between points are calculated based on the specified SRID, in meters.
Examples
SELECT id, st_leafcount(traj) FROM table_name WHERE id = 1;
id | st_leafcount
----+--------------
1 | 53
(1 row)
UPDATE table_name SET traj=st_removeDriftPoints(traj, 25.72, 9620, interval '30 seconds') WHERE id = 1;
--Two trajectory points are deleted.
SELECT id, st_leafcount(traj) FROM table_name WHERE id = 1;
id | st_leafcount
----+--------------
1 | 49
(1 row)See also
ST_leafcount: Returns the number of trajectory points in a trajectory object. Use this function to verify the result ofST_removeDriftPoints.ST_SetSRID: Sets the SRID for a trajectory object when you need to use a coordinate reference system other than WGS 84.