ST_IsValidTrajectory

Name

ST_IsValidTrajectory — Returns true if the geometry is a valid trajectory.

Synopsis

boolean ST_IsValidTrajectory ( geometry line ) ;

Description

Tell if a geometry encodes a valid trajectory. Valid trajectories are encoded as LINESTRING with M value growing from each vertex to the next.

Valid trajectories are expected as input to some spatio-temporal queries like ST_ClosestPointOfApproach

Availability: 2.2.0

This function supports 3d and will not drop the z-index.

Examples

-- A valid trajectory
SELECT ST_IsValidTrajectory(ST_MakeLine(
  ST_MakePointM(0,0,1),
  ST_MakePointM(0,1,2))
);
 t

-- An invalid trajectory
SELECT ST_IsValidTrajectory(ST_MakeLine(ST_MakePointM(0,0,1), ST_MakePointM(0,1,0)));
NOTICE:  Measure of vertex 1 (0) not bigger than measure of vertex 0 (1)
 st_isvalidtrajectory
----------------------
 f