ST_ForceSFS
What is ST_ForceSFS?
ST_ForceSFS converts an input to a geometry compatible with the OGC Simple Features Specification (SFS) — stripping curve types such as CIRCULARSTRING, COMPOUNDCURVE, or CURVEPOLYGON and (optionally) pinning to a specific SFS version.
1ST_ForceSFS(geometry geom) → geometry
2ST_ForceSFS(geometry geom, text version) → geometryThe two-argument form accepts an SFS version string such as '1.1'. Curves are linearised using default tolerance. Available since PostGIS 3.1.
When would you use ST_ForceSFS?
Use ST_ForceSFS when interoperating with strict SFS-compliant clients — some desktop GIS packages, older JDBC drivers, and Java-based spatial engines choke on curve geometry. Forcing SFS before export ensures the feature stream matches what the consumer can parse.
It is also a defensive pre-step in CI pipelines that emit shapefile, KML, or plain WKT output, where curves and higher-dimensional coordinates should be explicitly downcast rather than silently dropped.
FAQs
Does ST_ForceSFS change dimensionality?
It may, depending on version — the SFS 1.1 profile is 2D only, so Z/M ordinates are stripped when version = '1.1' is specified.
How are curves linearised?
Via the default ST_CurveToLine tolerance. For precise control, call ST_CurveToLine explicitly first with tuned tolerance parameters.
What version was ST_ForceSFS introduced?
PostGIS 3.1.
Is ST_ForceSFS idempotent on SFS-compliant input?
Yes — already-compliant geometry is returned unchanged.