我在 Python 中使用 GDAL/OGR 按顺序应用空间过滤器以计算点密度:
point = ogr.Geometry(ogr.wkbPoint)
point.AddPoint(xCoord, yCoord)
searchArea = point.Buffer(searchBuffer)
layer.SetSpatialFilter(searchArea)
density[i, j] = layer.GetFeatureCount()
但现在我想并行化我的代码,以提高性能。
如何在 Python 中与 GDAL/OGR 并行处理空间数据?特别是,我可以在数据源上并行应用空间过滤器吗?
我想使用 concurrent.futures.ThreadPoolExecutor() 作为执行器
最佳答案
GDAL 不支持对一个数据集进行并行操作。要么你必须多次打开它,否则,如果你需要一个高性能的实现,你将不得不自己实现它。 SetSpatialFilter
无论如何都不是最好的方法,因为它需要迭代每一对 (i, j)
的特征。
加载 R-Tree 中的所有特征,然后遍历 (i, j)
。这是一个标准算法,在 Python 中已有实现。
https://stackoverflow.com/questions/55955066/
相关文章:
continuous-integration - 如何在 1 个作业中定义 2 个具有不同 when
reactjs - VSCode 不会在 typescript 中导入
amazon-web-services - CloudFormation 无法创建 CodeDepl
express - 如何在 Google App Engine 中允许跨站点来源请求?
sql - 从 SQL Server 到 Oracle 使用点表示法与 OpenQuery
c# - 为什么 IServerStreamWriter 不发送通知响应?
azure - 如何在 Azure Devops 中为多模块 Maven 创建构建管道