我有一个Geopandas数据框架,大约有100万行字符串,我想用Geopandas的相应工具(GeoSeries.convex_hull)来计算它们的凸包。这会导致非常长的计算时间(大约4小时)。有没有人知道如何更快地做到这一点?
Geodataframe如下所示:
s_p_ed_hik length lanes i geometry
0 2.658196 4.263 None 0 LINESTRING (8.52441 47.39506, 8.52443 47.39502)
1 2.658196 4.263 None 0 LINESTRING (8.52441 47.39506, 8.52443 47.39502)
2 2.874100 4.343 None 0 LINESTRING (8.52443 47.39502, 8.52449 47.39502)
...以下是关于我的Geopandas Dataframe的Linestring长度的统计数据:
count 1063284.000000
mean 12.693328
std 13.335160
min 0.385000
25% 4.956000
50% 9.507000
75% 13.638000
max 287.713000发布于 2021-03-11 02:07:59
确保您安装了pygeos - https://geopandas.readthedocs.io/en/latest/getting_started/install.html#using-the-optional-pygeos-dependency。这将为您提供矢量化操作和很大的加速比。
conda install -c conda-forge pygeos您也可以尝试使用dask-geopandas来实现多核。
pip install git+https://github.com/geopandas/dask-geopandas.githttps://stackoverflow.com/questions/66562851
复制相似问题