CG_Volume — Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0.
float CG_Volume(
geometry geom1)
;
Availability: 3.5.0
Questo metodo richiede il backend SFCGAL.
Questa funzione supporta il 3d e non distrugge gli z-index.
Questa funzione supporta le Polyhedral Surface.
Questa funzione supporta i Triangoli e le Triangulated Irregular Network Surfaces (TIN).
Questo metodo implementa la specifica SQL/MM. SQL-MM IEC 13249-3: 9.1 (same as CG_3DVolume)
When closed surfaces are created with WKT, they are treated as areal rather than solid. To make them solid, you need to use CG_MakeSolid. Areal geometries have no volume. Here is an example to demonstrate.
SELECT CG_Volume(geom) As cube_surface_vol, CG_Volume(CG_MakeSolid(geom)) As solid_surface_vol FROM (SELECT 'POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )'::geometry) As f(geom); cube_surface_vol | solid_surface_vol ------------------+------------------- 0 | 1