开发者

What is the most efficient way I can to get a list of locations sorted by proximity given a location?

开发者 https://www.devze.com 2023-04-02 17:05 出处:网络
For example, Say I have a database of locations (latitude/longtitude), and a point. How can I grab the top 25 nearest locations from the database of locations?

For example,

Say I have a database of locations (latitude/longtitude), and a point. How can I grab the top 25 nearest locations from the database of locations?

Is there too a library, or a resource I can read up on various geospatial operations like开发者_如何学JAVA above? Thanks!


What you want to do sounds like a nearest neighbour search.

K-d trees are an efficient data structure to achieve this.

The CGAL library has spatial searching functions if you're looking for a library for C++.

0

精彩评论

暂无评论...
验证码 换一张
取 消