用于剪切形状文件的 geopandas 的替代品

问题描述

我正在尝试为伦敦的道路网络创建形状文件,我已经从 OS Open Road 下载了道路链接和节点的形状文件。根据 BNG 坐标将文件拆分为网格单元格,我尝试将覆盖伦敦的四个区域连接起来,然后进行过滤,因此我在伦敦以外没有任何东西。

我目前正在尝试使用伦敦边界形状文件(LSOA 文件分解为 1 个区域)进行过滤。然而,我尝试的所有操作似乎都不起作用,当我尝试运行以下代码时,它会运行,但是当我绘制连接的 GDF 时,掩码操作已被忽略。

代码如下

link_files = ['SU_RoadLink.shp','TL_RoadLink.shp','TQ_RoadLink.shp','SP_RoadLink.shp']
# concatenate shape files,note this section takes a long time to run

import functools

# functools allows the map function to apply the desired function (in this case read_file) with a keyword argument
# in this case 'mask' which allows us to read only a subset of the geometries within the individual shape files
# ie the geometries which fall within the prevIoUsly defined london boundary


link_gdf = gpd.GeoDataFrame(pd.concat(map(functools.partial(gpd.read_file,mask=london_boundary),link_files)))
node_gdf = gpd.GeoDataFrame(pd.concat(map(functools.partial(gpd.read_file,node_files)))
junc_gdf = gpd.GeoDataFrame(pd.concat(map(functools.partial(gpd.read_file,mway_junc_files)))

我也尝试读取具有相同掩码但结果不同的单个文件,这次不是忽略掩码,而是生成的 GDF 为空。

最后,当我尝试使用 .clip() .sjoin() 或 .overlay() 方法来实现结果时,我的内核每次都崩溃。

这是以前有人遇到过的吗?有没有 geopandas 的替代品?有人有什么建议吗?

提前致谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)