geopandas.GeoSeries.simplify#

GeoSeries.simplify(tolerance, preserve_topology=True)[source]#

Return a GeoSeries containing a simplified representation of each geometry.

The algorithm (Douglas-Peucker) recursively splits the original line into smaller parts and connects these parts’ endpoints by a straight line. Then, it removes all points whose distance to the straight line is smaller than tolerance. It does not move any points and it always preserves endpoints of the original line or polygon. See https://shapely.readthedocs.io/en/latest/manual.html#object.simplify for details

Simplifies individual geometries independently, without considering the topology of a potential polygonal coverage. If you would like to treat the GeoSeries as a coverage and simplify its edges, while preserving the coverage topology, see simplify_coverage().

Parameters:
tolerancefloat

All parts of a simplified geometry will be no more than tolerance distance from the original. It has the same units as the coordinate reference system of the GeoSeries. For example, using tolerance=100 in a projected CRS with meters as units means a distance of 100 meters in reality.

preserve_topology: bool (default True)

False uses a quicker algorithm, but may produce self-intersecting or otherwise invalid geometries.

See also

simplify_coverage

simplify geometries using coverage simplification

Notes

Invalid geometric objects may result from simplification that does not preserve topology and simplification may be sensitive to the order of coordinates: two geometries differing only in order of coordinates may be simplified differently.

Examples

>>> from shapely.geometry import Point, LineString
>>> s = geopandas.GeoSeries(
...     [Point(0, 0).buffer(1), LineString([(0, 0), (1, 10), (0, 20)])]
... )
>>> s
0    POLYGON ((1 0, 0.99518 -0.09802, 0.98079 -0.19...
1                         LINESTRING (0 0, 1 10, 0 20)
dtype: geometry
>>> s.simplify(1)
0    POLYGON ((0 1, 0 -1, -1 0, 0 1))
1              LINESTRING (0 0, 0 20)
dtype: geometry