5.3. Casting

A temporal value can be converted into a compatible type using the notation CAST(ttype1 AS ttype2) or ttype1::ttype2.

A common way to store temporal points in PostGIS is to represent them as geometries of type LINESTRING M and abuse the M dimension to encode timestamps as seconds since 1970-01-01 00:00:00. These time-enhanced geometries, called trajectories, can be validated with the function ST_IsValidTrajectory to verify that the M value is growing from each vertex to the next. Trajectories can be manipulated with the functions ST_ClosestPointOfApproach, ST_DistanceCPA, and ST_CPAWithin. Temporal point values can be converted to/from PostGIS trajectories.