<div dir="ltr"><div><div><div><div><div>Hi,<br></div>For my project I need fast searching for nearest neighbors in 3d space.<br><br></div>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?).<br>
<br></div>Anyway - on IRC I was said to:<br><br>CREATE OR REPLACE FUNCTION geometry_distance_centroid(geom1 geometry, geom2 geometry) RETURNS float8 AS 'SELECT ST_3DDistance($1,$2)' LANGUAGE 'sql' IMMUTABLE STRICT;<br>
<br></div>And then <-> will work with 3d, but will that also work *correctly* with gist indexes?<br><br></div>Regards,<br><br>depesz<br></div>