geopandas.GeoSeries.remove_repeated_points#

GeoSeries.remove_repeated_points(tolerance=0.0)[来源]#

返回一个 GeoSeries,该系列包含了移除重复点的输入几何的副本。

从坐标序列的开始,容差范围内的每个下一个点都会被移除。

使用非零容差删除重复点可能会导致返回无效的几何图形。

Parameters:
tolerancefloat, default 0.0

移除所有在此距离内的点。使用0.0来仅移除完全重复的点(默认值)。

示例

>>> 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)]),
...     ],
... )
>>> s
0                 LINESTRING (0 0, 0 0, 1 0)
1    POLYGON ((0 0, 0 0.5, 0 1, 0.5 1, 0 0))
dtype: geometry
>>> s.remove_repeated_points(tolerance=0.0)
0                      LINESTRING (0 0, 1 0)
1    POLYGON ((0 0, 0 0.5, 0 1, 0.5 1, 0 0))
dtype: geometry