Suppose I have a people and their GPS coordinates:
User1, 52.99, -41.0
User2, 91.44, -21.4
User3, 5.12, 24.5
...
My objective is: Given a set of coordinates,
- Out of all those users, find the ones within 20 meters. (how to do a SELECT statement like this?)
- For each of those users, get the distance.
As you probably guessed, these coordinates will be retrieved from a mobile phone. The phones will update their longitude/latitude every 10 seconds, as well as get that list of users <20 meters. It's dynamic.
I would like the best way to do this so that it can scale.
- Would you store the coordinates in a database, and update it every 10 seconds? (If you store it in a database...how would you calculate it...)
- How would you do this so it can scale?
By the way, there is already a formula that can calculate the distance between 2 coordinates http://www.johndcook.com/python_longitude_latitude.html. I just need to know what's the best way to do this technically (Trees, Database? What architecture? More specifically...how would you tie in the long/lat distance formula into the "SELECT" statement?)