geopandas.GeoSeries.remove_repeated_points#

GeoSeries.remove_repeated_points(tolerance=0.0)[source]#

Returns a GeoSeries containing a copy of the input geometry with repeated points removed.

From the start of the coordinate sequence, each next point within the tolerance is removed.

Removing repeated points with a non-zero tolerance may result in an invalid geometry being returned.

Parameters:
tolerancefloat, default 0.0

Remove all points within this distance of each other. Use 0.0 to remove only exactly repeated points (the default).

Examples

>>> from shapely import LineString, Polygon
>>> s = geopandas.GeoSeries(
...     [
...        LineString([(0, 0), (0, 0), (1, 0)]),
...        Polygon([(0, 0), (0, 0.5), (0, 1), (0.5, 1), (0,0)]),
...     ],
...     crs=3857
... )
>>> s
0    LINESTRING (0.000 0.000, 0.000 0.000, 1.000 0....
1    POLYGON ((0.000 0.000, 0.000 0.500, 0.000 1.00...
dtype: geometry
>>> s.remove_repeated_points(tolerance=0.0)
0                LINESTRING (0.000 0.000, 1.000 0.000)
1    POLYGON ((0.000 0.000, 0.000 0.500, 0.000 1.00...
dtype: geometry