[postgis-users] Querying for pairwise close approaches for a set of trajectories.

Stefan Novak slnovak+subscriptions at fastmail.fm
Thu Feb 14 22:14:07 PST 2019


Hello!

I'm interested in using PostGIS's support for trajectories to solve a problem I'm working on. I have a collection of 3D spatiotemporal trajectories (representing spacecraft orbits) that I'm needing to query for any close approaches among any pair of trajectories.  For my problem, a close approach occurs when the distance between two trajectories at the same time/measure falls below a threshold; a close approach can occur multiple times between a pair of trajectories. Naively, the problem can be solved by calculating pairwise distances for each epoch, resulting in ~ n^2/2*t distance calculations (where t is the number of timesteps), but I'm trying to avoid the n-squared problem. 

I started reading through the docs and was attracted to ST_ClosestPointOfApproach, however I'm interested in more than just the point of minimum distance between the trajectories -- it would be ideal to have multiple closest points of approach.

Is it possible to use PostGIS to perform this type of query?

On a related note, is it possible to index trajectory geometries such that a Cartesian product can be avoided when querying for close approaches between any pairs of trajectories?

Thanks for any insight you can share!

Cheers!


More information about the postgis-users mailing list