[postgis-devel] 3d kNN GiST?

hubert depesz lubaczewski depesz at gmail.com
Fri Jun 13 08:37:45 PDT 2014

For my project I need fast searching for nearest neighbors in 3d space.

We use postgis geometry with POINT(x y z), but apparently <-> doesn't show
3d distance, but rather 2d. Which is kinda bummer (why isn't it even listed
in docs?).

Anyway - on IRC I was said to:

CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2
geometry) RETURNS float8 AS 'SELECT ST_3DDistance($1,$2)' LANGUAGE 'sql'

And then <-> will work with 3d, but will that also work *correctly* with
gist indexes?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20140613/40877aa4/attachment.html>

More information about the postgis-devel mailing list