[postgis-devel] Distance operator in presence of M

Sandro Santilli strk at keybit.net
Thu Jun 4 01:31:46 PDT 2015


As you may have noticed, I'm working on adding some functions to work
with "trajectories". These are linestrings in which each point corresponds
to the location of an object at a given time. Location uses XYZ, time uses M.

The "closest points" between two trajectories are those in which the two
moving objects are spatially closest at the same point in time.

The ST_ClosestPointOfApproach function, which I committed in r13569,
returns such point in time.

Now, when it comes to the <<->> operator, for geometry or geography, we
have to pick a distance semantic in case of M presence. Right now this
semantic is just discarding M, compute in 2d or 3d space (whatever is
available in both operands) and then "add" the M difference to the euclidean
distance.

 https://trac.osgeo.org/postgis/ticket/3133

But I'm wondering, is current approach any useful ?
Would using the ClosestPointOfApproach semantic, in presence of M,
ruin any other valid use case for <<->> ?

While we can encode semantic in the function name for functions, with
operators we have a limited expressibility, so if <<->> has to be
used for pure euclidean distance we'd need another operator name for
the CPA semantic, and, I suppose, another operator class to make use
of KNN with that semantic.

--strk;



More information about the postgis-devel mailing list