Find top "n" nearby coordinates
I have a coordinate. I want to find the top "n" (n being a variable value) nearest coordinates out of several thousand rows stored on a MySQL database. I also want to be able to define maximum and minimum distances between the coordinate in question and the coordinates in the database.
How best am I to go about this? Would it be bonkers to use PHP as I understand the syntax much better than MySQL?
If I use a MySQL function, how do I move it between databases if I choose to switch servers? How is it stored?
Lastly, what is the most efficient method of getting through all these 开发者_JAVA百科coordinates accurately - the coordinates are all relatively close to one another?
Thanks for your time,
John.
It would be bonkers to do this in PHP, and not farm this off to MySQL. If you stick to double precision floating point numbers then you should have better precision than available accuracy (i.e. civilian GPS is accurate to at best about 5m, but your calculations will give a precision of a few centimetres)
精彩评论