libpysal.cg.
voronoi_frames
(points, radius=None, clip='extent')[source]¶Composite helper to return Voronoi regions and generator points as individual dataframes
originator points
distance to “points at infinity” used in building voronoi cells
an overloaded option about how to clip the voronoi cells. The options are: - ‘none’/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 of the input points.
of the input points.
contains all points (e.g. the smallest alphashape, using libpysal.cg.alpha_shape_auto)
Polygon: clip to an arbitrary Polygon
percent of map width to use to buffer the extent of the map, if clipping (default: .01, or 1 percent)
(region_df, points_df)
Finite Voronoi polygons as geometries
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