Returns a smoothed version of the input geometry object using the Chaikin smoothing algorithm.
Syntax
geometry ST_ChaikinSmoothing(geometry geom, integer nIterations, boolean preserveEndPoints);Parameters
| Parameter | Description |
|---|---|
geom | The input geometry object. |
nIterations | The number of smoothing iterations to run. Maximum value: 5. Default value: 1. |
preserveEndPoints | Specifies whether to preserve the endpoints of the input geometry object. Default value: false. Takes effect only when the input is a polygon. |
Usage notes
Each iteration doubles the number of vertices in the geometry object. The function places a new vertex at one-quarter of the distance along each segment before and after the original point, then removes the original point.
New vertices are interpolated across all dimensions of the input geometry object, including the Z dimension and M dimension.
The output geometry contains more vertices than the input. To reduce the vertex count, use ST_Simplify or ST_SimplifyVW.
Examples
The following example queries the smoothing results for nIterations=1 and nIterations=5 on the same LineString geometry:
SELECT g, ST_ChaikinSmoothing(g, 1),
ST_ChaikinSmoothing(g, 5)
FROM (SELECT 'LINESTRING(0 0,2 2,3 1,3.5 1.5,5 0,5.25 0.25,5.5 0)'::geometry AS g) AS t;


该文章对您有帮助吗?