Using ST_3DDistance will work and give you the right answer, but it will not be index assisted. The KNN operator <-> is only implemented against the 2D index currently.
Paul On Fri, May 25, 2012 at 5:15 PM, Bartosz Bekier <bartosz.bek...@gmail.com> wrote: > Hello All! > > This is my first post on the PostGIS mailing list:-). > > I would like to use the <-> to solve the nearest neighbor problem, but in 3D > space. I tried to do this in 2D and it works perfectly, but apparently it > doesn't cover the 3D case. > > Basically I have a table of 3D points (x, y, z) and would like to do: > > ORDER BY point <-> POINT(0 0 0) > > but the distance taken into account should be 3D Euclidean distance. Do I > have to use ST_3DDistance() for it or is there a faster way? > > Thanks in advance! > > Regards, > -- > Bartosz Bekier > > > _______________________________________________ > postgis-users mailing list > postgis-users@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users