This topic describes the ST_Volume and ST_3DVolume functions. These functions calculate the volume of a closed 3D object.

Syntax

float8 ST_Volume(meshgeom geom);
float8 ST_Volume(sfmesh sfmesh);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshThe sfmesh object.

Description

  • These functions calculate the volume of a closed 3D object.
  • The volume of a point, linestring, or polygon is 0.
  • If the geom parameter is invalid, NULL is returned.
  • If the 3D model is not closed, NULL is returned.

Examples

select ST_Volume('MESHGEOM(PATCH(TRIANGLESTRIP Z(0 0 0,0 10 0,0 0 10,10 0  0,0 0 0), TRIANGLE Z( 0 0 0,0 10 0,10 0 0)))'::mesh);

------------------
 166.666666666667