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....@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 >> 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. >> >> 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. > */ > /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */