经度/纬度的 KDTree [英] KDTree for longitude/latitude

查看:25
本文介绍了经度/纬度的 KDTree的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Python 中是否有任何软件包允许对球体表面的经度/纬度进行类似 kdtree 的操作?(这需要适当考虑球面距离,以及经度的环绕).

Are there any packages in Python that allow one to do kdtree-like operations for longitude/latitudes on the surface of a sphere? (this would need to take into account the spherical distances properly, as well as the wraparound in longitude).

推荐答案

二叉搜索树无法通过设计处理极坐标表示的环绕.您可能需要将坐标转换为 3D 笛卡尔空间,然后应用您喜欢的搜索算法,例如 kD-Tree、Octree 等.

A binary search tree cannot handle the wraparound of the polar representation by design. You might need to transform the coordinates to a 3D cartesian space and then apply your favorite search algorithm, e.g., kD-Tree, Octree etc.

或者,如果您可以将坐标的输入范围限制在表面上的一个小区域,您可以将适当的地图投影应用于该区域,即不会过度扭曲您所在区域的形状,并应用这些无环绕笛卡尔地图坐标上的标准二叉搜索树.

Alternatively, if you could limit the input range of coordinates to a small region on the surface, you could apply an appropriate map projection to this region, i.e., one that does not distort the shape of your area too much, and apply a standard binary search tree on these no-wrap-around cartesian map coordinates.

这篇关于经度/纬度的 KDTree的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆