ST_ForceCurve

更新时间:
复制 MD 格式

Converts a geometry object to its curved representation.

Syntax

geometry ST_ForceCurve(geometry g);

Parameters

ParameterDescription
gThe geometry object to convert.

Description

ST_ForceCurve converts linear geometry types to their curve equivalents:

  • Line → CompoundCurve

  • MultiLineStringMultiCurve

  • Polygon → CurvePolygon

  • MultiPolygonMultiSurface

If the input is already in curved representation, the function returns it unchanged.

The function supports 3D objects and preserves Z coordinates. It also supports circular strings and curves.

Example

SELECT ST_AsText(ST_ForceCurve(ST_GeomFromText('POLYGON((1 1,2 1,2 2,1 2,1 1))')));
              st_astext
-------------------------------------
 CURVEPOLYGON((1 1,2 1,2 2,1 2,1 1))
(1 row)