0

I'm having problems with several libraries and I can't think of a way to fix the problem. When I perform Voronoi processing. Some polygons are generated "inwards" causing numerous polygon overlaps.

Here is the code snippet that generated the problem. The same grid of points processed in Qgis presents no problem.

  p = []
  for i, df in enumerate(data_frame_new.X):
    p.append((data_frame_new.X[i], data_frame_new.Y[i]))

  p_array = np.array(p)
  p = coords_to_points(p_array)

GEOVORONOI

 region_df, point_df = voronoi_regions_from_coords(p, boundary_shape)
 gs = gpd.GeoSeries(region_df)
 region_df = gpd.GeoDataFrame(gs, columns=["geometry"])

libpysal Voronoi

  region_df, point_df = voronoi_frames(p, radius=None, clip = boundary_shape)
  region_df = region_df.drop(columns=['area'], axis=1).reset_index(drop=True)
  region_df_clip = region_df.clip(ext)

scipy Voronoi

coords = points_to_coords(data_frame_new.geometry)

vor = Voronoi(coords)
lines = [
    shapely.geometry.LineString(vor.vertices[line])
    for line in vor.ridge_vertices
    if -1 not in line
]
features = [i for i in range(len(lines))]
gdr = gpd.GeoDataFrame({'feature': features, 'geometry': lines})

Erros voronoi

Michael Delgado
  • 13,789
  • 3
  • 29
  • 54
Ramon
  • 1
  • 1

0 Answers0