ST_RemovePoint

Name

ST_RemovePoint — Remove point from a linestring.

Synopsis

geometry ST_RemovePoint ( geometry linestring , integer offset ) ;

Description

Remove a point from a linestring, given its 0-based index. 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;