Trajectory introduction

更新时间:
复制 MD 格式

When tracking moving objects — vehicles, vessels, delivery riders, or IoT sensors — raw coordinate logs quickly become unwieldy. PolarDB for PostgreSQL provides a native trajectory data type that aggregates time-stamped location records into a single, queryable object, making spatio-temporal analysis significantly more efficient than storing individual coordinate rows.

How trajectories work

A trajectory is a time-ordered sequence of locations recorded as an object moves. Each point in the sequence stores at minimum a timestamp and coordinates:

timexy
2020-04-11 17:42:30114.3539.28

Sampling points can also carry additional attributes. In this example, speed is recorded alongside the coordinates:

timexyspeed
2020-04-11 17:42:30114.3539.284.3

As the object moves, successive samples form a sequence of trajectory points:

timexyspeed
2020-04-11 17:42:30114.3539.284.3
2020-04-11 17:43:30114.3639.284.8
2020-04-11 17:44:30114.3539.293.5

Together, these points form a spatio-temporal trajectory.

Spatio-temporal trajectory

What you can do with trajectories

Once raw sampling data is aggregated into a trajectory object, PolarDB for PostgreSQL supports the following operations:

OperationDescription
Compress trajectory pointsReduce the number of stored points, lowering storage costs
Calculate intersectionsFind where two trajectories overlap
Extract sub-trajectoriesSlice a portion of a trajectory based on a time range
Determine trajectory similarityCompare movement patterns between two trajectories