This topic describes the ST_RemovePoint function. This function removes a point with the specified index number from a LineString object.

Syntax

geometry  ST_RemovePoint(geometry  linestring , integer  offset);

Parameters

Parameter Description
linestring The geometry object that you want to specify.
offset The index number.

Description

  • The index number starts from 0.
  • The ST_RemovePoint function is useful for turning 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)