# libpysal.cg.voronoi_frames

libpysal.cg.voronoi_frames(geometry: GeoSeries | GeoDataFrame | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str], radius: float | None = None, clip: str | Geometry | None = 'bounding_box', shrink: float = 0, segment: float = 0, grid_size: float = 1e-05, return_input: bool | None = None, as_gdf: bool | None = None) → GeoSeries

  Create Voronoi polygons from a GeoSeries of points, lines, or polygons.

  This is a wrapper around `shapely.voronoi_polygons` that handles not only points but also lines and polygons through their discretization and dissolution of the resulting polygons.

  Parameters:
    geometry `GeoSeries` | `GeoDataFrame` | numpy:array_like

      A GeoSeries of points, lines, or polygons or an array of coordinates.

    radius `python:float`, `optional`

      Deprecated. Has no effect any longer.

    clip `python:str`, `shapely.geometry.Polygon`, `optional`

      Polygon used to clip the Voronoi polygons, by default “bounding_box” The options are:

      - `None` – No clip is applied. Voronoi cells may be arbitrarily larger that the source map. Note that this may lead to cells that are many orders of magnitude larger in extent than the original map. Not recommended.

      - `'bounding_box'` – Clip the voronoi cells to the bounding box of the input points.

      - `'convex_hull'` – Clip the voronoi cells to the convex hull of the input points.

      - `'alpha_shape'` – Clip the voronoi cells to the tightest hull that contains all points (e.g. the smallest alpha shape, using `libpysal.cg.alpha_shape_auto()`).

      - `shapely.Polygon` – Clip to an arbitrary Polygon.

    shrink `python:float`, `optional`

      Distance for the negative buffer of polygons required when there are polygons sharing portion of their exterior, by default 0

    segment `python:float`, `optional`

      Distance for the segmentation of lines used to add coordinates to lines or polygons prior Voronoi tessellation, by default 0

    grid_size `python:float`, `optional`

      Grid size precision under which the voronoi algorithm is generated, by default 1e-5

    return_input bool, `optional`

      Whether to return the input geometry, defaults to True

    as_gdf bool, `optional`

      Whether to return the output as a GeoDataFrame (True) or GeoSeries (False), defaults to True

  Returns:
    `GeoSeries` | `GeoDataFrame` | `python:tuple`

      GeoSeries of Voronoi polygons with index allowing to link back to the input