Optimum search with geospatial coordinates

S. Dale Morrey sdalemorrey at gmail.com
Tue Mar 18 20:32:39 MDT 2014


I have a resource constrained system that contains a map and a list of
points on the map given as longitude and latitude.
Each point is it's own seperate object.
I also have a point on the map that corresponds to the user's current
location.

What I want to do is search all of the points in the map and return the one
closest to the user.
The long and lat are both signed doubles (language is Java but the
principles should basically be the same).

What would be the optimal search given that the list of points is contained
in a Vector (array).
I'm thinking something like a loop that goes through each item and compares
the long and lat differences for the smallest differences.  But that seems
to me like a suboptimal solution.
I have access to background threads and I do wonder about maybe 2 threads
doing this, but one counting from the front of the array and another
counting from the back.  At present there are only a couple of hundred
points, but it's possible in the future that the list might balloon to
thousands.

Anyways just hoping someone knows of a better search method.


More information about the PLUG mailing list