ST_LineToCurve
Name
ST_LineToCurve — Converts a linear geometry to a curved geometry.
Synopsis
geometry
ST_LineToCurve
(
geometry
geomANoncircular
)
;
Description
Converts plain LINESTRING/POLYGON to CIRCULAR STRINGs and Curved Polygons. Note much fewer points are needed to describe the curved equivalent.
|
|
|
If the input LINESTRING/POLYGON is not curved enough to clearly represent a curve, the function will return the same input geometry. |
Availability: 1.3.0
This function supports 3d and will not drop the z-index.
This method supports Circular Strings and Curves.
Examples
This example converts a linear Polygon approximating a circle to a CurvePolygon.
WITH data AS (
SELECT ST_Buffer('POINT(1 3)'::geometry, 3) AS geom
)
SELECT geom AS "input_Linear polygon",
ST_LineToCurve(geom) AS "Curved polygon"
FROM data;
This example converts a 3D linear ring to a CircularString while preserving Z.
WITH data AS (
SELECT ST_Translate(
ST_Force3D(ST_Boundary(ST_Buffer(ST_Point(1, 3), 2, 2))),
0, 0, 3
) AS geom
)
SELECT geom AS "input_Linear ring at Z=3",
ST_LineToCurve(geom) AS "Circular string at Z=3"
FROM data;