제목

ST_RemoveRepeatedPoints — Returns a version of a geometry with duplicate points removed.

요약

geometry ST_RemoveRepeatedPoints(geometry geom, float8 tolerance = 0.0);

설명

Returns a version of the given geometry with duplicate consecutive points removed. The function processes only (Multi)LineStrings, (Multi)Polygons and MultiPoints but it can be called with any kind of geometry. Elements of GeometryCollections are processed individually. The endpoints of LineStrings are preserved.

If a non-zero tolerance parameter is provided, vertices within the tolerance distance of one another are considered to be duplicates. The distance is computed in 2D (XY plane).

Enhanced: 3.2.0

2.2.0 버전부터 사용할 수 있습니다.

This function supports Polyhedral surfaces.

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

예시

Code
SELECT ST_RemoveRepeatedPoints('MULTIPOINT ((1 1),(2 2),(3 3),(2 2))');
래스터 출력
MULTIPOINT((1 1),(2 2),(3 3))
Figure
Geometry figure for visual-st-removerepeatedpoints-01
Code
SELECT ST_RemoveRepeatedPoints('LINESTRING (0 0,0 0,1 1,0 0,1 1,2 2)');
래스터 출력
LINESTRING(0 0,1 1,0 0,1 1,2 2)
Figure
Geometry figure for visual-st-removerepeatedpoints-02

Example: Collection elements are processed individually.

Code
SELECT ST_RemoveRepeatedPoints('GEOMETRYCOLLECTION (LINESTRING (1 1,2 2,2 2,3 3),POINT (4 4),POINT (4 4),POINT (5 5))');
래스터 출력
GEOMETRYCOLLECTION(LINESTRING(1 1,2 2,3 3), POINT(4 4), POINT(4 4), POINT(5 5))
Figure
Geometry figure for visual-st-removerepeatedpoints-03

Example: Repeated point removal with a distance tolerance.

Code
SELECT ST_RemoveRepeatedPoints('LINESTRING (0 0,0 0,1 1,5 5,1 1,2 2)', 2);
래스터 출력
LINESTRING(0 0,5 5,2 2)
Figure
Geometry figure for visual-st-removerepeatedpoints-04

참고

ST_Simplify