如何解决用于剪切形状文件的 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 举报,一经查实,本站将立刻删除。