查找最近邻居/纬度和经度

发布于 2024-10-06 02:10:43 字数 189 浏览 8 评论 0原文

我有一个表(DB2 数据库),其中包含城市信息以及相应的纬度和经度以及与城市相关的许多其他信息。我的要求是:

我的应用程序的输入将是纬度和经度,这可能是也可能不是存储在数据库中的精确纬度和经度。我需要借助输入的纬度和经度从表中找到最近的城市信息。非常感谢任何帮助。

java中是否有可用的最近邻居实现 或者 SQL 来处理这个问题

I have a table (DB2 database) with city information and corresponding latitude and longitude and many other info related to the city. My requirement is:

Input to my application will be latitude and longitude which may or many not be exact lat and long stored in DB. I need to find the nearest City info from the table with the help of input latitude and longitude. Any help is highly appreciated.

Is there a nearest neighbor implementation in java available for this
or
SQL to handle this

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滴情不沾 2024-10-13 02:10:43

您可以使用 KD-Tree:

KDTree Implements in Java

在 SQL 中,您可以 Pythagoras 找到,然后按距给定点的距离排序,但这可能不会很有效。

You could use a KD-Tree:

KDTree Implementation in Java

Within SQL, you could Pythagoras to find, and then order by, the distance from a given point, but this likely wouldn't be very efficient.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文