Page 1 of 1

Help with Lat long

Posted: Tue Apr 06, 2010 1:03 pm
by fraser5002
Hi, i have a database that has a lat long for each entry .

I have a query that supplies the lat longs of all entires within a lat long window what i want to do is calculate the distance between each set of lat longs and a base lat long ( i can do the calculation fine) i need to then sort all my entries based on this calculated distance how would i go about this?

Re: Help with Lat long

Posted: Wed Apr 07, 2010 1:42 am
by JakeJ
So you want to build a distance matrix?

Go look up examples of how to build a multiplication table, there are plenty. It should serve as a base for what you're doing.

Re: Help with Lat long

Posted: Wed Apr 07, 2010 9:53 am
by pickle

Code: Select all

SELECT
    [ FANCY CALCULATION HERE ] as `distance`
...
ORDER BY
  `distance`