This topic describes the ST_Resample function. This function resamples a trajectory.
Syntax
trajectory ST_Resample(trajectory traj, config);
Parameters
Parameter | Description |
---|---|
traj | The trajectory that you want to split. |
config | The rule that is used to split the trajectory. Format: {"Rule":"Value"} .
|
Only one rule can be specified by the config parameter. The following table describes
the rules that you can specify by using the config parameter.
Rule Name | Type | Description |
---|---|---|
add_point.distance_lesser | Floating point | Evenly add points to each trajectory so that the distance between two points is smaller than the parameter value. |
add_point.period_lesser | String that can be converted into the INTERVAL type | Evenly add points to each trajectory so that the period of time between two points is smaller than the parameter value. |
drop_point.distance_lesser | Floating point | When the sum of distances between the end points of multiple consecutive segments of a trajectory are less than the given distance, merge the consecutive segments to form a segment. Only the start and end points of the obtained segment are retained. |
drop_point.period_lesser | String of interval type | When the sum of time of periods required between multiple consecutive segments of a trajectory is less than the given period of time, merge the consecutive segments. Only the start and end points of the obtained segment are retained. |
Description
This function splits a trajectory based on the specified rule and returns an array of sub-trajectories.
Examples
SELECT ST_Resample(ST_MakeTrajectory('POINT(1 1)'), '{"add_point.distance_lesser":3}');
st_resample
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{"trajectory":{"version":1,"type":"STPOINT","leafcount":1,"start_time":"2000-01-01 00:00:00","end_time":"2000-01-01 00:00:00","spatial":"POINT(1 1)","timeline":["2000-01-01 00:00:00"]}}
(1 row)
SELECT ST_Resample(ST_MakeTrajectory('POINT(1 1)'), '{"add_point.period_lesser":"2 day"}');
st_resample
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{"trajectory":{"version":1,"type":"STPOINT","leafcount":1,"start_time":"2000-01-01 00:00:00","end_time":"2000-01-01 00:00:00","spatial":"POINT(1 1)","timeline":["2000-01-01 00:00:00"]}}
(1 row)
SELECT ST_Resample(ST_MakeTrajectory('POINT(1 1)'), '{"drop_point.distance_lesser":3}');
st_resample
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
{"trajectory":{"version":1,"type":"STPOINT","leafcount":1,"start_time":"2000-01-01 00:00:00","end_time":"2000-01-01 00:00:00","spatial":"POINT(1 1)","timeline":["2000-01-01 00:00:00"]}}
(1 row)