geopandas.GeoSeries.convex_hull¶
- property GeoSeries.convex_hull¶
Returns a
GeoSeries
of geometries representing the convex hull of each geometry.The convex hull of a geometry is the smallest convex Polygon containing all the points in each geometry, unless the number of points in the geometric object is less than three. For two points, the convex hull collapses to a LineString; for 1, a Point.
See also
GeoSeries.envelope
bounding rectangle geometry
Examples
>>> from shapely.geometry import Polygon, LineString, Point, MultiPoint >>> s = geopandas.GeoSeries( ... [ ... Polygon([(0, 0), (1, 1), (0, 1)]), ... LineString([(0, 0), (1, 1), (1, 0)]), ... MultiPoint([(0, 0), (1, 1), (0, 1), (1, 0), (0.5, 0.5)]), ... MultiPoint([(0, 0), (1, 1)]), ... Point(0, 0), ... ] ... ) >>> s 0 POLYGON ((0.00000 0.00000, 1.00000 1.00000, 0.... 1 LINESTRING (0.00000 0.00000, 1.00000 1.00000, ... 2 MULTIPOINT (0.00000 0.00000, 1.00000 1.00000, ... 3 MULTIPOINT (0.00000 0.00000, 1.00000 1.00000) 4 POINT (0.00000 0.00000) dtype: geometry
>>> s.convex_hull 0 POLYGON ((0.00000 0.00000, 0.00000 1.00000, 1.... 1 POLYGON ((0.00000 0.00000, 1.00000 1.00000, 1.... 2 POLYGON ((0.00000 0.00000, 0.00000 1.00000, 1.... 3 LINESTRING (0.00000 0.00000, 1.00000 1.00000) 4 POINT (0.00000 0.00000) dtype: geometry