ST_deviation

更新时间: 2026-03-28 13:12:04

Returns the spatial deviation between a processed trajectory and the original trajectory. A smaller return value indicates that the processed trajectory more closely approximates the original. Call this function after trajectory compression to evaluate quality loss.

Syntax

float8 ST_deviation(trajectory traj, trajectory after_oper_traj)

Parameters

ParameterDescription
trajThe original trajectory object.
after_oper_trajThe processed trajectory object, such as the output of ST_compress.

Example

The following query compresses a trajectory using a tolerance of 0.001 and then measures the deviation of the compressed trajectory from the original.

SELECT ST_deviation(traj, ST_compress(traj, 0.001)) FROM traj_test;

Output:

    st_deviation
---------------------
 0.00919177345596219
(1 row)

See also

  • ST_compress: Compress a trajectory object to reduce its size.

上一篇: ST_sort 下一篇: Attribute metadata