Returns the maximum 3D Euclidean distance between two geometry objects.
Syntax
float ST_3DMaxDistance(geometry g1, geometry g2)Parameters
| Parameter | Description |
|---|---|
| g1 | The first geometry object. |
| g2 | The second geometry object. |
Description
Returns the farthest (maximum) Euclidean distance between the two geometry objects, measured in the unit of their projected coordinate system.
Supports polyhedral surfaces.
Preserves z coordinates — the function operates fully in 3D space and does not drop z values.
Examples
SELECT ST_3DMaxDistance('POINT(0 0 0)'::geometry,'LINESTRING(0 0 1,1 1 0)'::geometry);
st_3dmaxdistance
------------------
1.4142135623731
(1 row)