对一条轨迹重采样。
语法
trajectory ST_Resample(trajectory traj, config);
参数
参数名称 | 描述 |
---|---|
traj | 被切分的轨迹对象。 |
config | 切分轨迹的规则。格式{"规则":"取值"} 。
|
目前包含以下可选规则,每次调用此函数时,仅可选择一个规则:
规则名称 | 参数类型 | 说明 |
---|---|---|
add_point.distance_lesser | 浮点数 | 在每条轨迹线上均匀添加点,使每一段之间的距离均小于参数。 |
add_point.period_lesser | 可以转化为Interval类型的字符串 | 在每条轨迹线上均匀添加点,使每一段的时长均小于参数。 |
drop_point.distance_lesser | 浮点数 | 当相邻多段轨迹线段的端点两两之间距离均小于给定的时间长度时,将其合并(仅保留起点和终点)。 |
drop_point.period_lesser | 可以转化为Interval类型的字符串 | 当相邻多段轨迹线段的时间长度之和小于给定的时间长度时,将其合并(仅保留起点和终点)。 |
描述
根据提前设定的规则切分轨迹对象,返回切分后的子轨迹数组。
示例
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)