SFCGAL Accessors and Setters
CG_ForceLHR
Force LHR orientation
Synopsis
geometry CG_ForceLHR(geometry geom)
Description
Availability: 3.5.0
CG_IsPlanar
Check if a surface is or not planar
Synopsis
boolean CG_IsPlanar(geometry geom)
Description
Availability: 3.5.0
CG_IsSolid
Test if the geometry is a solid. No validity check is performed.
Synopsis
boolean CG_IsSolid(geometry geom1)
Description
Availability: 3.5.0
CG_MakeSolid
Cast the geometry into a solid. No check is performed. To obtain a valid solid, the input geometry must be a closed Polyhedral Surface or a closed TIN.
Synopsis
geometry CG_MakeSolid(geometry geom1)
Description
Availability: 3.5.0
CG_Orientation
Determine surface orientation
Synopsis
integer CG_Orientation(geometry geom)
Description
The function only applies to polygons. It returns -1 if the polygon is counterclockwise oriented and 1 if the polygon is clockwise oriented.
Availability: 3.5.0
CG_Area
Calculates the area of a geometry
Synopsis
double precision CG_Area(geometry
geom)
Description
Calculates the area of a geometry.
Performed by the SFCGAL module
Note
NOTE: this function returns a double precision value representing the area.
Availability: 3.5.0
Geometry Examples
SELECT CG_Area('Polygon ((0 0, 0 5, 5 5, 5 0, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1), (3 3, 4 3, 4 4, 3 4, 3 3))');
cg_area
--------
25
(1 row)
See Also
CG_3DArea
Computes area of 3D surface geometries. Will return 0 for solids.
Synopsis
floatCG_3DArea(geometry geom1)
Description
Availability: 3.5.0
SQL-MM IEC 13249-3: 8.1, 10.5
Examples
Note: By default a PolyhedralSurface built from WKT is a surface geometry, not solid. It therefore has surface area. Once converted to a solid, no area.
SELECT CG_3DArea(geom) As cube_surface_area,
CG_3DArea(CG_MakeSolid(geom)) As solid_surface_area
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_area | solid_surface_area
-------------------+--------------------
6 | 0
See Also
CG_Area, CG_MakeSolid, CG_IsSolid, CG_Area
CG_Volume
Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0.
Synopsis
float CG_Volume(geometry geom1)
Description
Availability: 3.5.0
SQL-MM IEC 13249-3: 9.1 (same as CG_3DVolume)
Example
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
See Also
CG_3DArea, CG_MakeSolid, CG_IsSolid
ST_ForceLHR
Force LHR orientation
Synopsis
geometry ST_ForceLHR(geometry geom)
Description
Warning
ST_ForceLHR is deprecated as of 3.5.0. Use CG_ForceLHR instead.
Availability: 2.1.0
ST_IsPlanar
Check if a surface is or not planar
Synopsis
boolean ST_IsPlanar(geometry geom)
Description
Warning
ST_IsPlanar is deprecated as of 3.5.0. Use CG_IsPlanar instead.
Availability: 2.2.0: This was documented in 2.1.0 but got accidentally left out in 2.1 release.
ST_IsSolid
Test if the geometry is a solid. No validity check is performed.
Synopsis
boolean ST_IsSolid(geometry geom1)
Description
Warning
ST_IsSolid is deprecated as of 3.5.0. Use CG_IsSolid instead.
Availability: 2.2.0
ST_MakeSolid
Cast the geometry into a solid. No check is performed. To obtain a valid solid, the input geometry must be a closed Polyhedral Surface or a closed TIN.
Synopsis
geometry ST_MakeSolid(geometry geom1)
Description
Warning
ST_MakeSolid is deprecated as of 3.5.0. Use CG_MakeSolid instead.
Availability: 2.2.0
ST_Orientation
Determine surface orientation
Synopsis
integer ST_Orientation(geometry geom)
Description
Warning
ST_Orientation is deprecated as of 3.5.0. Use CG_Orientation instead.
The function only applies to polygons. It returns -1 if the polygon is counterclockwise oriented and 1 if the polygon is clockwise oriented.
Availability: 2.1.0
ST_3DArea
Computes area of 3D surface geometries. Will return 0 for solids.
Synopsis
floatST_3DArea(geometry geom1)
Description
Availability: 2.1.0
SQL-MM IEC 13249-3: 8.1, 10.5
Examples
Note: By default a PolyhedralSurface built from WKT is a surface geometry, not solid. It therefore has surface area. Once converted to a solid, no area.
SELECT ST_3DArea(geom) As cube_surface_area,
ST_3DArea(ST_MakeSolid(geom)) As solid_surface_area
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_area | solid_surface_area
-------------------+--------------------
6 | 0
See Also
ST_Area, ST_MakeSolid, ST_IsSolid, ST_Area
ST_Volume
Computes the volume of a 3D solid. If applied to surface (even closed) geometries will return 0.
Synopsis
float ST_Volume(geometry geom1)
Description
Availability: 2.2.0
SQL-MM IEC 13249-3: 9.1 (same as ST_3DVolume)
Example
When closed surfaces are created with WKT, they are treated as areal rather than solid. To make them solid, you need to use ST_MakeSolid. Areal geometries have no volume. Here is an example to demonstrate.
SELECT ST_Volume(geom) As cube_surface_vol,
ST_Volume(ST_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