ST_ForceCurve
What is ST_ForceCurve?
ST_ForceCurve promotes a geometry to its curve-enabled OGC type without changing the vertex data. A LINESTRING becomes a COMPOUNDCURVE containing that line; a POLYGON becomes a CURVEPOLYGON; a MULTILINESTRING becomes a MULTICURVE.
ST_ForceCurve(geometry geom) → geometryAlready-curved geometry is returned unchanged. The function does not detect or reconstruct arcs — use ST_LineToCurve for that.
When would you use ST_ForceCurve?
Use ST_ForceCurve in mixed schemas where some rows contain curves (CIRCULARSTRING, COMPOUNDCURVE) and others are straight but must be cast to the same parent type for uniform column typing — for example, geometry(CompoundCurve, 3857).
It is also helpful in round-trip tests that validate curve-preserving tooling: forcing a straight geometry through the curve type path exposes problems in serializers, ORMs, or client libraries that drop the curve wrapper.
FAQs
Does ST_ForceCurve introduce actual arcs?
No. It only changes the type wrapper — the vertices and their straight-segment interpretation are unchanged. Use ST_LineToCurve to detect and reconstruct arcs.
What if the input is already a curve?
It is returned unchanged (as a new value).
Will it round-trip through text?
Yes — ST_AsText of the forced geometry will show COMPOUNDCURVE(...) or CURVEPOLYGON(...) even when the internals are all straight.
Does it work on MultiPolygons?
Yes. MULTIPOLYGON becomes MULTISURFACE, the OGC curve-enabled counterpart.