ST_RemovePoint

更新时间:
复制 MD 格式

Removes a point at the specified index from a LineString object.

Syntax

geometry ST_RemovePoint(geometry linestring, integer offset)

Parameters

ParameterDescription
linestringThe LineString geometry object.
offsetThe zero-based index of the point to remove.

Description

  • The index starts from 0.

  • ST_RemovePoint is useful for converting a closed ring into a nonclosed LineString object.

  • This function supports 3D objects and does not delete z coordinates.

Examples

SELECT ST_AsText(ST_RemovePoint(ST_GeomFromText('LINESTRING(2 1,1 1,1 0)'),0));
      st_astext
---------------------
 LINESTRING(1 1,1 0)
(1 row)