pysal.lib.cg.voronoi_frames

pysal.lib.cg.voronoi_frames(points, radius=None)[source]

Composite helper to return Voronoi regions and generator points as individual dataframes

Parameters:
points : array-like

originator points

Returns:
_ : tuple

(region_df, points_df)

region_df : GeoDataFrame (if geopandas available, otherwise Pandas DataFrame)

Finite Voronoi polygons as geometries

points_df : GeoDataFrame (if geopandas available, otherwise Pandas DataFrame)

Originator points as geometries

Notes

If Geopandas is not available the return types will be Pandas DataFrames each with a geometry column populated with PySAL shapes. If Geopandas is available, return types are GeoDataFrames with a geometry column populated with shapely geometry types.

Examples

>>> points = [(10.2, 5.1), (4.7, 2.2), (5.3, 5.7), (2.7, 5.3)]
>>> regions_df, points_df = voronoi_frames(points)
>>> regions_df.shape
(4, 1)
>>> regions_df.shape == points_df.shape
True