[postgis-users] Recursive CTE nearest neighbour function

Mark Wynter mark at dimensionaledge.com
Sun Feb 8 14:30:32 PST 2015


Hi Vincent.   When doing KNN searches on point to point datasets, your suggestion is perfect!  
Using your approach, Use Case (2) case took 0.7 seconds, down from my previous best of 7 seconds.
The reason I didn’t go down this pathway initially was for the reasons you mentioned - bounding box approximations of lines and polygons and the potential for “inaccuracies.”  My use case that prompted this was finding OSM road linestrings closest to points.  Seeing your code, I’ve also got new appreciation for the keyword LATERAL.   Many thanks,  Mark





More information about the postgis-users mailing list