[postgis-users] Finding the right nearest polygon

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Thu Sep 27 13:13:32 PDT 2012


Hi,

Paul suggests a two steps approach to find the nearest polygon (or line) using the KNN operator at the end of this page:

http://blog.opengeo.org/2011/09/28/indexed-nearest-neighbour-search-in-postgis/

Tell me if I'm wrong but I guess this technique does not guarantee that you actually find the nearest geometry... There is always a chance (tiny I admit) that the bounding box (or the centroid) of the nearest polygon is the 101th one and hence not selected by the query...

If I'm right, is there another technique that guarantee that the nearest one you find is the right one? (Without computing the distance between every polygons...)

Pierre



More information about the postgis-users mailing list