ST_deviation

更新时间:
复制 MD 格式

Returns the spatial deviation between a processed trajectory and the original trajectory, expressed as a floating-point number in the coordinate units of the input trajectories. A larger value indicates greater spatial error introduced by the processing operation (such as compression).

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 result of ST_compress.

Example

The following query checks how much spatial accuracy is lost when compressing a trajectory with a tolerance of 0.001. The return value is in the coordinate units of the input trajectory.

-- Check spatial deviation after compressing with a tolerance of 0.001
SELECT ST_deviation(traj, ST_compress(traj, 0.001)) FROM traj_test;

Result:

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

See also

  • [ST_compress](): Compress a trajectory object using a specified tolerance.