Calculates the 3D Euclidean distance between two geometry objects in a projected coordinate system.
Syntax
float ST_3DDistance(geometry g1, geometry g2);Parameters
| Parameter | Description |
|---|---|
| g1 | The first geometry object. |
| g2 | The second geometry object. |
Usage notes
Preserves z coordinates — does not drop the z dimension from 3D objects.
Supports polyhedral surfaces.
Examples
SELECT ST_3DDistance('POINT(0 0 0)'::geometry,'POINT(1 1 1)'::geometry);
st_3ddistance
------------------
1.73205080756888
(1 row)