> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ST_RemoveRepeatedPoints

This function eliminates consecutive duplicate points within a geometry, preserving endpoints of LineStrings. It operates on (Multi)LineStrings, (Multi)Polygons, and MultiPoints, processing GeometryCollection elements individually. When an optional 'tolerance' value is provided, vertices within that distance are also considered duplicates.

<img src="https://mintcdn.com/wherobots/wLm_IRUSNlHZTHJP/images/sql-functions/ST_RemoveRepeatedPoints/ST_RemoveRepeatedPoints.svg?fit=max&auto=format&n=wLm_IRUSNlHZTHJP&q=85&s=9077d47033b12c04b23061b7c89640ee" alt="ST_RemoveRepeatedPoints" width="500" height="300" data-path="images/sql-functions/ST_RemoveRepeatedPoints/ST_RemoveRepeatedPoints.svg" />

## Signatures

```sql theme={"system"}
ST_RemoveRepeatedPoints(geom: Geometry, tolerance: Double)
```

```sql theme={"system"}
ST_RemoveRepeatedPoints(geom: Geometry)
```

## Parameters

<ParamField body="geom" type="Geometry" required>
  The input geometry.
</ParamField>

<ParamField body="tolerance" type="Double">
  The distance tolerance.
</ParamField>

## Return type

<ResponseField type="Geometry">
  The resulting geometry.
</ResponseField>

## Examples

```sql theme={"system"}
SELECT ST_RemoveRepeatedPoints(
        ST_GeomFromWKT('MULTIPOINT ((20 20), (10 10), (30 30), (40 40), (20 20), (30 30), (40 40))')
       )
```

```
MULTIPOINT ((20 20), (10 10), (30 30), (40 40))
```

```sql theme={"system"}
SELECT ST_RemoveRepeatedPoints(
        ST_GeomFromWKT('LINESTRING (20 20, 10 10, 30 30, 40 40, 20 20, 30 30, 40 40)')
       )
```

```
LINESTRING (20 20, 10 10, 30 30, 40 40, 20 20, 30 30, 40 40)
```

### Each geometry within a collection is processed independently.

```sql theme={"system"}
ST_RemoveRepeatedPoints(
        ST_GeomFromWKT('GEOMETRYCOLLECTION (POINT (10 10), POINT(10 10), LINESTRING (20 20, 20 20, 30 30, 30 30), MULTIPOINT ((80 80), (90 90), (90 90), (100 100)))')
    )
```

```
GEOMETRYCOLLECTION (POINT (10 10), POINT (10 10), LINESTRING (20 20, 30 30), MULTIPOINT ((80 80), (90 90), (100 100)))
```

### Elimination of repeated points within a specified distance tolerance.

```sql theme={"system"}
SELECT ST_RemoveRepeatedPoints(
        ST_GeomFromWKT('LINESTRING (20 20, 10 10, 30 30, 40 40, 20 20, 30 30, 40 40)'),
        20
       )
```

```
LINESTRING (20 20, 40 40, 20 20, 40 40)
```
