Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Calculating Distance

by rinceWind (Monsignor)
on Feb 21, 2007 at 19:13 UTC ( #601407=note: print w/replies, xml ) Need Help??

in reply to Calculating Distance

We've encountered this requirement for Here, alongside the lat + long, we store planar X-Y coordinates in the database, using a projection such as UTM or Ordnance Survey. Then, we use Pythagoras in SQL queries to find all entries within the distance.

This works well for city guides - our main application, but less well over large distances, where curvature of the oblate spheroid that is the Earth, becomes a factor.

I don't know what your application is, but check out OpenGuides, as there's probably quite a bit of code you can reuse. Or even set up a Guide yourself, if that's what you are trying to achieve.


Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://601407]
robby_dobby is still not used to PM's interface. /o\
[oiskuu]: War. War never changes.
[robby_dobby]: "My cat is a very good mouser" -- that's a great way to identify a Brit among a crowd :-)
thezip looks around to see no one else dancing to Piazzola...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-11-17 19:44 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (272 votes). Check out past polls.