[thelist] Sorting Long and Lat in Mysql...

Tris beertastic at gmail.com
Wed Nov 17 14:27:50 CST 2010

Hey all...
I've been tasked with a global search project.
They want to search a database of pictures, all with long/lat
references storied per image in a mysql DB.

However, their search criteria is a little specific.

A simplified table structure is:
`id` INT auto inc primary
`imagePath` varchar 255
`long` DECIMAL 12,7
`lat` DECIMAL 12,7

I need to provide the SQL statement with a start long/lat position.
They then want to receive 34 images, going south from their initial
long reference.. once they get to -90 (the bottom of the earth) to pop
over 1 degree to the right/East and search up to the north to 90 and
repeat until 34 images are found.

What's confusing me is how to calculate the minus to plus changes..
ensuring that we loop up and down along the earths 'long' reference.

Has anyone done this before..?
I'd LOVE to do it in a single query...

Ok, back to google!!





"The only people who don't make mistakes are those who don't do anything"

Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others
to laugh at him.`
Thomas Szasz

More information about the thelist mailing list