This topic describes the ST_3DMaxDistance function. This function calculates the farthest distance between two geometry objects in the 3D space.

Syntax

float  ST_3DMaxDistance(geometry  g1 , geometry  g2);

Parameters

Parameter Description
g1 The first geometry object that you want to specify.
g2 The second geometry object that you want to specify.

Description

  • This function returns the maximum Euclidean distance between the geometry objects that you specify. The distance is measured in the unit that is specified by the projected coordinate system of the geometry objects.
  • This function supports polyhedral surfaces.
  • This function supports 3D objects and does not delete z coordinates.

Examples

SELECT ST_3DMaxDistance('POINT(0 0 0)'::geometry,'LINESTRING(0 0 1,1 1 0)'::geometry);
 st_3dmaxdistance
------------------
  1.4142135623731
(1 row)