3

I have a database with locations with their lat and long coordinates. The area of locations is quite small with lots of them quite near each other.

I'm using this stored procedure in my project. http://www.artfulsoftware.com/infotree/queries.php?&bw=1680#109

I'm having troubles with accuracy. I need it to return more accurate results (in metres) instead of just 0 distance.

Can it be modified so I get better results?

4
  • Your link brings up a giant page full of links, not a specific proc, so it is hard to be helpful.
    – bmargulies
    Jul 31, 2010 at 16:17
  • Which version of MySQL, and have you tried using double precision? Jul 31, 2010 at 16:43
  • See also: gis.stackexchange.com/questions/2/… Jul 31, 2010 at 16:45
  • I'm using MySQL 5.0.67.
    – Mishal
    Aug 2, 2010 at 8:49

1 Answer 1

2

If the distances are so close together that single precision floats can't capture the distance, you probably don't need to account for the curvature of the earth at all — you must be dealing with phenomena only a few meters apart. The simplest solution is to then use double precision, as Rowland mentioned, or easier yet, just compute a linear distance between the two points, ignoring earth curvature.

In the highly unlikely event that you do in fact have high-precision, high-accuracy data, you can use the Vincenty's formula, which can give accurate results down to millimeters.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.