All Products
Search
Document Center

ApsaraDB RDS:ST_equals

Last Updated:Mar 28, 2026

Checks whether two trajectory objects occupy the same spatial path within a specified time range.

Syntax

boolean ST_equals(trajectory traj1, trajectory traj2, tsrange range);
boolean ST_equals(trajectory traj1, trajectory traj2, timestamp t1, timestamp t2);

Pass the time range as a tsrange value or as two separate timestamp values (t1, t2).

Parameters

ParameterDescription
traj1, traj2The trajectory objects to compare.
t1The start time of the time range.
t2The end time of the time range.
rangeThe time range, as a tsrange value.

Return value

Returns boolean:

  • t — the two trajectories are spatially equal within the time range.

  • f — the two trajectories are not spatially equal within the time range.

Examples

The following example checks whether two trajectories stored in traj_table are spatially equal between 13:00 and 14:00 on January 1, 2010. The result f indicates they are not equal in that interval.

Select ST_equals((Select traj from traj_table where id=1), (Select traj from traj_table where id=2), '2010-1-1 13:00:00', '2010-1-1 14:00:00');
    st_equals
------------------
  f