Chapter 8. SFCGAL Functions Reference
Chapter 8. SFCGAL Functions Reference
SFCGAL is a C++ wrapper library around CGAL that provides advanced 2D and 3D spatial functions. For robustness, geometry coordinates have an exact rational number representation.
Installation instructions for the library can be found on the SFCGAL home page (
http://www.sfcgal.org
).
To enable the functions use
create extension postgis_sfcgal
.
8.1. SFCGAL Management Functions
This section lists functions for determining version of SFCGAL and library dependencies you are running.
- postgis_sfcgal_version — Returns the version of SFCGAL in use
- postgis_sfcgal_full_version — Returns the full version of SFCGAL in use including CGAL and Boost versions
8.2. SFCGAL Accessors and Setters
These functions access or set properties of geometries. Geometries primarily supported by these functions are TINS and Polyhedral Surfaces.
- CG_ForceLHR — Force LHR orientation
- CG_IsPlanar — Check if a surface is or not planar
- CG_IsSolid — Test if the geometry is a solid. No validity check is performed.
- 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.
- CG_Orientation — Determine surface orientation
- CG_Area — Calculates the area of a geometry
- CG_3DArea — Computes area of 3D surface geometries. Will return 0 for solids.
- CG_Volume — Computes the volume of a 3D geometry. Closed surfaces can have non-zero volume.
8.3. SFCGAL Processing and Relationship Functions
- CG_Intersection — Computes the intersection of two geometries
- CG_Intersects — Tests if two geometries intersect (they have at least one point in common)
- CG_3DIntersects — Tests if two 3D geometries intersect
- CG_Difference — Computes the geometric difference between two geometries
- CG_3DDifference — Perform 3D difference
- CG_Distance — Computes the minimum distance between two geometries
- CG_3DDistance — Computes the minimum 3D distance between two geometries
- CG_3DConvexHull — Computes the 3D convex hull of a geometry.
- CG_3DIntersection — Perform 3D intersection
- CG_Union — Computes the union of two geometries
- CG_3DUnion — Perform 3D union using postgis_sfcgal.
- CG_AlphaShape — Computes an Alpha-shape enclosing a geometry
- CG_ApproxConvexPartition — Computes approximal convex partition of the polygon geometry
- CG_ApproximateMedialAxis — Compute the approximate medial axis of an areal geometry.
- CG_GenerateFlatRoof — Generate a flat (box) roof from a footprint polygon.
- CG_GenerateHippedRoof — Generate a hipped roof from a footprint polygon.
- CG_GenerateGableRoof — Generate a gable roof from a footprint polygon.
- CG_GenerateSkillionRoof — Generate a skillion (single-slope) roof from a footprint polygon.
- CG_GenerateRoof — Generate a roof of the requested type from a footprint polygon.
- CG_PolygonRepair — Repair an invalid polygon or multipolygon.
- CG_ConstrainedDelaunayTriangles — Return a constrained Delaunay triangulation around the given input geometry.
- CG_Extrude — Extrude a surface to a related volume
- CG_ExtrudeStraightSkeleton — Straight Skeleton Extrusion
- CG_GreeneApproxConvexPartition — Computes approximal convex partition of the polygon geometry
- CG_MinkowskiSum — Performs Minkowski sum
- CG_OptimalAlphaShape — Computes an Alpha-shape enclosing a geometry using an "optimal" alpha value.
- CG_OptimalConvexPartition — Computes an optimal convex partition of the polygon geometry
- CG_StraightSkeleton — Compute a straight skeleton from a geometry
- CG_Tesselate — Perform surface Tessellation of a polygon or polyhedralsurface and returns as a TIN or collection of TINS
- CG_Triangulate — Triangulates a polygonal geometry
- CG_Visibility — Compute a visibility polygon from a point or a segment in a polygon geometry
- CG_YMonotonePartition — Computes y-monotone partition of the polygon geometry
- CG_StraightSkeletonPartition — Computes the straight skeleton partition of a polygon.
- CG_3DBuffer — Computes a 3D buffer around a geometry.
- CG_Rotate — Rotates a geometry by a given angle around the origin (0,0).
- CG_2DRotate — Rotates a geometry by a given angle around a specified point in 2D.
- CG_3DRotate — Rotates a geometry in 3D space around an axis vector.
- CG_RotateX — Rotates a geometry around the X-axis by a given angle.
- CG_RotateY — Rotates a geometry around the Y-axis by a given angle.
- CG_RotateZ — Rotates a geometry around the Z-axis by a given angle.
- CG_Scale — Scales a geometry uniformly in all dimensions by a given factor.
- CG_3DScale — Scales a geometry by separate factors along X, Y, and Z axes.
- CG_3DScaleAroundCenter — Scales a geometry in 3D space around a specified center point.
- CG_Translate — Translates (moves) a geometry by given offsets in 2D space.
- CG_3DTranslate — Translates (moves) a geometry by given offsets in 3D space.
- CG_Simplify — Reduces the complexity of a geometry while preserving essential features and Z/M values.
- CG_3DAlphaWrapping — Computes a 3D Alpha-wrapping strictly enclosing a geometry.
- CG_NurbsCurveInterpolate — Creates an interpolating NURBS curve passing through all given data points
- CG_NurbsCurveApproximate — Creates an approximating NURBS curve fitting data points within a tolerance
- CG_NurbsCurveDerivative — Computes the derivative (tangent, curvature) of a NURBS curve at a given parameter
8.4. Deprecated SFCGAL Function Aliases
-
ST_3DIntersection
— Deprecated alias for
CG_3DIntersection. -
ST_3DDifference
— Deprecated alias for
CG_3DDifference. -
ST_3DUnion
— Deprecated alias for
CG_3DUnion. -
ST_Tesselate
— Deprecated alias for
CG_Tesselate. -
ST_3DArea
— Deprecated alias for
CG_3DArea. -
ST_Extrude
— Deprecated alias for
CG_Extrude. -
ST_ForceLHR
— Deprecated alias for
CG_ForceLHR. -
ST_Orientation
— Deprecated alias for
CG_Orientation. -
ST_MinkowskiSum
— Deprecated alias for
CG_MinkowskiSum. -
ST_StraightSkeleton
— Deprecated alias for
CG_StraightSkeleton. -
ST_ApproximateMedialAxis
— Deprecated alias for
CG_ApproximateMedialAxis. -
ST_IsPlanar
— Deprecated alias for
CG_IsPlanar. -
ST_Volume
— Deprecated alias for
CG_Volume. -
ST_MakeSolid
— Deprecated alias for
CG_MakeSolid. -
ST_IsSolid
— Deprecated alias for
CG_IsSolid. -
ST_ConstrainedDelaunayTriangles
— Deprecated alias for
CG_ConstrainedDelaunayTriangles. -
ST_3DConvexHull
— Deprecated alias for
CG_3DConvexHull. -
ST_AlphaShape
— Deprecated alias for
CG_AlphaShape. -
ST_OptimalAlphaShape
— Deprecated alias for
CG_OptimalAlphaShape.
These
ST_
names remain available for compatibility and emit deprecation notices.
Their entries contain only the legacy signature and migration link. Use the corresponding
CG_
pages for behavior, examples, and geometry support details.