Removes a point at the specified index from a LineString geometry.
Syntax
geometry ST_RemovePoint(geometry linestring, integer offset);Parameters
| Parameter | Description |
|---|---|
linestring | The LineString geometry to modify. |
offset | The zero-based index of the point to remove. |
Usage notes
The index is zero-based: the first point has index
0.Use this function to convert a closed ring into an open LineString by removing the duplicate end point.
Supports 3D geometries and preserves Z coordinates.
Examples
Remove the first point from a LineString
SELECT ST_AsText(ST_RemovePoint(ST_GeomFromText('LINESTRING(2 1,1 1,1 0)'), 0));Output:
st_astext
---------------------
LINESTRING(1 1,1 0)
(1 row)该文章对您有帮助吗?