Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#3133 closed enhancement (fixed)

ND-Distance function for KNN <<->> support

Reported by: pramsey Owned by: pramsey
Priority: critical Milestone: PostGIS 2.2.0
Component: postgis Version: master
Keywords: Cc:


To allow <<->> to also partake in exact KNN support, a distance function that can handle, 2d, 3d and 4d inputs is needed. It should to standard 3d distance and 3dz distance. For 3dm cases it should find the closest points in m space and add that distance to the total. Same for 3dzm cases, but using the 3dz closest point functionality.

Change History (5)

comment:1 Changed 7 years ago by pramsey

Completed rough draft at r13607.

TO DO test on 9.5 (so can actually test the recheck) and make the regress tests conditional on pgsql version

comment:2 Changed 7 years ago by pramsey

Resolution: fixed
Status: newclosed

Completed recheck support for 3dm and 4d geometries at r13610, separated out knn and knn_recheck tests

comment:3 Changed 7 years ago by strk

I'm thinking if such handling of M is any useful :/ Would using the CPA distance (closest point of approach) be too narrow in your opinion ? That'd be, only consider points having the same M as valid candidates for being "closest points" (ST_ClosestPointOfApproach gives you the right M for that)

comment:4 Changed 7 years ago by robe

I committed nd recheck tests at r13615 and r13616

I haven't tested geometries with M though, guess I should add that. Just currently tests XYZ

comment:5 Changed 7 years ago by pramsey

Good, don't bother testing M in case we want to change it. As it stands the behaviour is hard to describe in terms of KNN (if your coordinates are lon/lat then your nearest distance will be heavily affected by the M, if your coordinates are in something projected, the nearest distance will be more likely to be spatially determined). Maybe it's best to just ignore M/T entirely for the KNN op.

Note: See TracTickets for help on using tickets.