(self, voronoi_diagram, unique_id, ids, crs)
return regions_gdf
Generate GeoDataFrame of Voronoi regions from scipy.spatial.Voronoi.
Generate GeoDataFrame of Voronoi regions from scipy.spatial.Voronoi.
Generate GeoDataFrame of Voronoi regions from scipy . spatial . Voronoi .
def _regions(self, voronoi_diagram, unique_id, ids, crs):
        """
        Generate GeoDataFrame of Voronoi regions from scipy.spatial.Voronoi.
        """
        vertices = pd.Series(voronoi_diagram.regions).take(voronoi_diagram.point_region)
        polygons = []
        for region in vertices:
            if -1 not in region:
                polygons.append(pygeos.polygons(voronoi_diagram.vertices[region]))
            else:
                polygons.append(None)

        regions_gdf = gpd.GeoDataFrame(
            {unique_id: ids}, geometry=polygons, crs=crs
        ).dropna()
        regions_gdf = regions_gdf.loc[
            regions_gdf[unique_id] != -1
        ]  # delete hull-based cells

        return regions_gdf
def _regions ( self , voronoi_diagram , unique_id , ids , crs ) : vertices = pd . Series ( voronoi_diagram . regions ) . take ( voronoi_diagram . point_region ) polygons = [ ] for region in vertices : if - 1 not in region : polygons . append ( pygeos . polygons ( voronoi_diagram . vertices [ region ] ) ) else : polygons . append ( None ) regions_gdf = gpd . GeoDataFrame ( { unique_id : ids } , geometry = polygons , crs = crs ) . dropna ( ) regions_gdf = regions_gdf . loc [ regions_gdf [ unique_id ] != - 1 ] # delete hull-based cells return regions_gdf