dtoolkit.geoaccessor.geoseries.voronoi#

dtoolkit.geoaccessor.geoseries.voronoi(s, /, boundary: Polygon | MultiPolygon = None, only_edges: bool = False) gpd.GeoSeries[source]#

Computes a Voronoi diagram from Point geometry.

Deprecated since version 0.0.22: The ‘voronoi’ is deprecated. Please use ‘GeoSeries.voronoi_polygons’ in geopandas 1.1 instead.

Parameters:
boundaryPolygon or MultiPolygon, optional

The outer boundary of the diagram. If None, use the convex hull of the inputs.

only_edgesbool, default False

If True, only return the edges.

Returns:
GeoSeries
Raises:
TypeError

If the geometry type is not Point.

IndexError

If the length of the GeoSeries is less than 3.

Notes

These Points may construct a polygon.

Examples

>>> import dtoolkit.geoaccessor
>>> import geopandas as gpd
>>> df = gpd.GeoDataFrame(geometry=gpd.points_from_xy([0, 1, 2], [0, 1, 0]))
>>> df
      geometry
0  POINT (0 0)
1  POINT (1 1)
2  POINT (2 0)
>>> df.voronoi()
0             POLYGON ((1 0, 0 0, 0.5 0.5, 1 0))
2         POLYGON ((1.5 0.5, 2 0, 1 0, 1.5 0.5))
1    POLYGON ((1 0, 0.5 0.5, 1 1, 1.5 0.5, 1 0))
dtype: geometry