geopandas.GeoSeries.simplify¶
- GeoSeries.simplify(*args, **kwargs)¶
Returns 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 http://shapely.readthedocs.io/en/latest/manual.html#object.simplify for details
- 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.
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.00000 0.00000, 0.99518 -0.09802, 0... 1 LINESTRING (0.00000 0.00000, 1.00000 10.00000,... dtype: geometry
>>> s.simplify(1) 0 POLYGON ((1.00000 0.00000, 0.00000 -1.00000, -... 1 LINESTRING (0.00000 0.00000, 0.00000 20.00000) dtype: geometry