Optimum search with geospatial coordinates
S. Dale Morrey
sdalemorrey at gmail.com
Tue Mar 18 22:48:37 MDT 2014
It's a severely resource constrained environment. Think a j2me feature
phone as a possible target.
I get a data file from an external source periodically, but a DB is not an
option here, there just isn't enough room for the overhead and that really
seems like overkill for something like this.
I can't see the search being frequent enough to warrant more than a few
hours of tinkering, but I would like the search to be as snappy as possible.
It can easily be "as the crow flies" so we don't need to be worried about
best path, just closest point.
Anyways thanks for the advice.
On Tue, Mar 18, 2014 at 8:51 PM, Tod Hansmann <plug.org at todandlorna.com>wrote:
> On 3/18/2014 8:32 PM, S. Dale Morrey wrote:
>> 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
>> What I want to do is search all of the points in the map and return the
>> 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
>> in a Vector (array).
>> I'm thinking something like a loop that goes through each item and
>> 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
>> Anyways just hoping someone knows of a better search method.
>> Fix your data formats? At least if you're going to do this search a lot
> or need it to be quicker.
> -Tod Hansmann
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
More information about the PLUG