简体   繁体   中英

Geospatial lookup

I'm developing a algorithm and data structures to handle lookup by euclidean distance on a large quantities of 2-dimentional points.

I've tried researching this on google scholar but found nothing yet (probably because I don't know what this problem is usually called in the literature).

These are the two approaches I've considered:

Approach 1: Create a bidimentional grid with buckets. Insert points into buckets, keeping a reference of each point's bucket. On lookup of point P with distance D, get its bucket B and all the buckets where any of the corners of its grid-square have (distance to B) < D. Finally, enumerate the points in all those buckets and calculate distance to P.

Approach 2: Create two lists, each with all the point ordered by one of the coordinates (x,y). On lookup of point P with distance D, perform binary search to find two points in each of the list in order to find the rectangular region where points have their Chebyshev distance to P < D. Finally, calculate euclidean distance of all those points to P

I'm guessing the state-of-the-art algorithms will be vastly superior to this, though? Any ideas on this are appreciated

Some tips to help you:

  • Take a look at KDTree , it is a k-dimensional tree (2d in your case) which is one of the best ways to look for nearest-neighbors.
  • Perhaps you could benefit from a Spatial Database , specifically developed to deal with Geospatial Data;
  • You could use any of the above with your desired distance function. Depending on your application, you want map distance, great circle distance, constant slope distance, constant bearing distance, etc. Your distance function should be known by you. I use to apply great circle (haversine) distance to deal with google-maps-like maps and tracks.

In case you want a Python implementation, there is scipy.spatial ( docs ). From this module, the function query_ball_point((px, py), radius) seems to be what you're looking for.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM