Name

ST_RemovePoint — 从线串中删除点。

Synopsis

geometry ST_RemovePoint(geometry linestring, integer offset);

描述

给定线串索引(从0开始),从线串中删除点。用于将闭合直线(环)转换为开放线串。

增强版:3.2.0

可用性:1.1.0

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

示例

通过删除闭合直线(环)的终点来确保不闭合直线。假设geom的类型为LINESTRING

UPDATE sometable
        SET geom = ST_RemovePoint(geom, ST_NPoints(geom) - 1)
        FROM sometable
        WHERE ST_IsClosed(geom);

另请参阅

ST_AddPoint, ST_NPoints, ST_NumPoints