geopandas.GeoSeries.delaunay_triangles#
- GeoSeries.delaunay_triangles(tolerance=0.0, only_edges=False)[source]#
Returns a
GeoSeries
consisting of objects representing the computed Delaunay triangulation around the vertices of an input geometry.The output is a
GeometryCollection
containing polygons (default) or linestrings (see only_edges).Returns an empty GeometryCollection if an input geometry contains less than 3 vertices.
- Parameters
- tolerancefloat | array-like, default 0.0
Snap input vertices together if their distance is less than this value.
- only_edgesbool | array_like, (optional, default False)
If set to True, the triangulation will return a collection of linestrings instead of polygons.
Examples
>>> from shapely import LineString, MultiPoint, Polygon >>> s = geopandas.GeoSeries( ... [ ... MultiPoint([(50, 30), (60, 30), (100, 100)]), ... Polygon([(50, 30), (60, 30), (100, 100), (50, 30)]), ... LineString([(50, 30), (60, 30), (100, 100)]), ... ] ... ) >>> s 0 MULTIPOINT (50.000 30.000, 60.000 30.000, 100.... 1 POLYGON ((50.000 30.000, 60.000 30.000, 100.00... 2 LINESTRING (50.000 30.000, 60.000 30.000, 100.... dtype: geometry
>>> s.delaunay_triangles() 0 GEOMETRYCOLLECTION (POLYGON ((50.000 30.000, 6... 1 GEOMETRYCOLLECTION (POLYGON ((50.000 30.000, 6... 2 GEOMETRYCOLLECTION (POLYGON ((50.000 30.000, 6... dtype: geometry
>>> s.delaunay_triangles(only_edges=True) 0 MULTILINESTRING ((50.000 30.000, 100.000 100.0... 1 MULTILINESTRING ((50.000 30.000, 100.000 100.0... 2 MULTILINESTRING ((50.000 30.000, 100.000 100.0... dtype: geometry