[postgis-users] distance() for 3d points

Rick Schumeyer rschumeyer at ieee.org
Fri Oct 21 11:57:47 PDT 2005


Does the distance() function work for 3d points, or is there a distance3d()
function?

 

My quick tests show that distance() seems to use only the first two
dimensions and ignore the third:

 

select AddGeometryColumn('t2','geom',-1,'POINT', 3);

 

insert into t2 (name, geom) values ('p1',GeomFromEWKT('POINT(0 0 0)'));

insert into t2 (name, geom) values ('p2',GeomFromEWKT('POINT(0 0 1)'));

insert into t2 (name, geom) values ('p3',GeomFromEWKT('POINT(0 1 1)'));

insert into t2 (name, geom) values ('p4',GeomFromEWKT('POINT(1 1 1)'));

 

select distance( geom ,GeomFromEWKT('POINT(0 0 0)')) from t2;

 

    distance     

-----------------

               0

               0

               1

 1.4142135623731

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20051021/a641f06e/attachment.html>


More information about the postgis-users mailing list