问题描述
我有两个 geopandas 数据框 dfMd
和 centers
。 dfMd
由多边形构成,而 centers
由点构成。 Here 文件链接。
f,ax=plt.subplots()
dfMd.plot(ax=ax,column='volume')
centers.plot(ax=ax,color='red')
我想生成扩展到整个几何体的点的 Voronoi
流苏。这就是我正在做的:
from shapely.geometry import mapping
g = [i for i in centers.geometry]
coords = []
for i in range(0,len(g)):
coords.append(mapping(g[i])["coordinates"]) # for first feature/row
from libpysal.cg.voronoi import voronoi,voronoi_frames
regions,vertices = voronoi(coords)
region_df,point_df = voronoi_frames(coords)
fig,ax = plt.subplots()
region_df.plot(ax=ax,color='white',edgecolor='black',lw=3)
dfMd.plot(ax=ax,column='volume',alpha=0.1)
point_df.plot(ax=ax,color='red')
fig,color='red')
如何将 Voronoi
区域扩展到我的 dfMd
的外部边界?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)