Nome

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

Sinossi

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

Descrizione

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

Disponibilità: 2.2.0

Questa funzione supporta le Polyhedral Surface.

Questa funzione supporta il 3d e non distrugge gli z-index.

Esempi

Code
SELECT ST_RemoveRepeatedPoints('MULTIPOINT ((1 1),(2 2),(3 3),(2 2))');
Output
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)');
Output
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))');
Output
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);
Output
LINESTRING(0 0,5 5,2 2)
Figure
Geometry figure for visual-st-removerepeatedpoints-04

Si veda anche

ST_Simplify