geopandas.GeoSeries.minimum_clearance_line#
- GeoSeries.minimum_clearance_line()[source]#
Returns a
GeoSeries
of linestrings whose endpoints define the minimum clearance.A geometry’s “minimum clearance” is the smallest distance by which a vertex of the geometry could be moved to produce an invalid geometry.
If the geometry has no minimum clearance, an empty LineString will be returned.
Requires Shapely >= 2.1.
Added in version 1.1.0.
See also
Examples
>>> from shapely.geometry import Polygon, LineString, Point >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (0, 1), (0, 0)]), ... LineString([(0, 0), (1, 1), (3, 2)]), ... Point(0, 0), ... ] ... ) >>> s 0 POLYGON ((0 0, 1 1, 0 1, 0 0)) 1 LINESTRING (0 0, 1 1, 3 2) 2 POINT (0 0) dtype: geometry
>>> s.minimum_clearance_line() 0 LINESTRING (0 1, 0.5 0.5) 1 LINESTRING (0 0, 1 1) 2 LINESTRING EMPTY dtype: geometry