[postgis-devel] Distance operator in presence of M
Sandro Santilli
strk at keybit.net
Wed Jun 10 09:27:36 PDT 2015
An update:
I've added a |=| operator (mnemonic: it's two rotated T for time, and
an equal sign forms at the center for "syncronized") that returns
the same as a new ST_DistanceCPA function (distance between the points
of closest approach).
When building PostGIS against PostgreSQL 9.5+, this operator is capable
of using an N-dimensional index (where it was added with strategy number 20).
It's been an interesting excercise as it shows you can have different
operators with different "distance" semantic all using the same index.
I'm now wondering if we should then add <-> to the N-D operator too now.
--strk;
On Thu, Jun 04, 2015 at 09:37:59PM +0200, Sandro Santilli wrote:
> On Thu, Jun 04, 2015 at 11:00:41AM -0700, Paul Ramsey wrote:
> > Yes, I’d cry, because then KNN won’t work. You’d have to also
> > figure out how to implement a closest approach model that works on index
> > keys, such that the closest-approach distance between two keys was always
> > less than the same distance between two actual objects.
>
> That shouldn't be a big problem.
>
> Time can only make the minimum distance between two trajectories _larger_
> than it is in space. That is, while spatial only minimum distance is the
> distance between any point in one geometry to any point in another,
> spatio-temporal one reduces the possible pairs to only those points having
> the same T (M) value.
>
> So by only computing the spatial distance between keys (discarding M)
> would already ensure it is less (or equal) than the same distance between
> any two actual objects below those keys. Maybe not optimal, but should work.
>
> --strk;
More information about the postgis-devel
mailing list