Name

ST_RemovePoint — Removes point from a linestring. Offset is 0-based.

Synopsis

geometry ST_RemovePoint(geometry linestring, integer offset);

Description

Removes point from a linestring. Useful for turning a closed ring into an open line string

Availability: 1.1.0

This function supports 3d and will not drop the z-index.

Examples

--guarantee no LINESTRINGS are closed
--by removing the end point.  The below assumes the_geom is of type LINESTRING
UPDATE sometable
	SET the_geom = ST_RemovePoint(the_geom, ST_NPoints(the_geom) - 1)
	FROM sometable
	WHERE ST_IsClosed(the_geom) = true;
		

See Also

ST_AddPoint, ST_NPoints, ST_NumPoints