基于gpu的地表近邻搜索
vincenty-cuda-nns的Python项目详细描述
使用CUDA进行Vincenty最近邻搜索
运行在gpu上并使用Vincenty's formula
应用程序
近邻搜索是位置数据分析的关键组成部分:
- 最近邻索引基于测量点之间的距离
- 模式分析算法(global moran's i,getis ord general g)和模式分析算法(anselin local moran's i,getis ord gi*)使用k-nn方法定义邻域都基于点之间的测量距离
使用Vincenty公式,可以使用地理坐标对任何位置执行位置分析。
要求
- 支持CUDA的GPU,具有计算能力2.0或更高版本,并带有高达数据的NVIDIA驱动程序。
- CUDA toolkit
安装
pip install vincenty-cuda-nns
用法示例
importgeopandasasgpdfromvincenty_cuda_nnsimportCudaTreedf=gpd.read_file('points.geojson')# data is array of points like [longitude, latitude]data=np.stack(df['geometry']).astype(np.float32)# build tree for the datacuda_tree=CudaTree(data,leaf_size=4)# query over the tree for nearest neighbor (including itself)distances,indices=cuda_tree.query(n_neighbors=2)