I&#39;ve been struggling with SQL a lot more basic than that recently so I can&#39;t offer much query help.<div><br></div><div>But as an idea, couldn&#39;t you add an extra 2 fields to the table to indicate North/South and East/West and have them populated through code - i.e. the lat and long goes through a quick algorith to determine if it&#39;s n/w and e/w and the result is added to the db. Then you wouldn&#39;t need to calcuate any minus or anything for the SQL query - when you SELECT the lot you could add extra ORDER BY to automatically sort them north-to-south and east-to-west.<div>
<br></div><div>Ross</div><div><br><br><div class="gmail_quote">On 17 November 2010 20:39, Tris <span dir="ltr">&lt;<a href="mailto:beertastic@gmail.com">beertastic@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey all...<br>
I&#39;ve been tasked with a global search project.<br>
They want to search a database of pictures, all with long/lat<br>
references storied per image in a mysql DB.<br>
<br>
However, their search criteria is a little specific.<br>
<br>
A simplified table structure is:<br>
`id` INT auto inc primary<br>
`imagePath` varchar 255<br>
`long` DECIMAL 12,7<br>
`lat` DECIMAL 12,7<br>
<br>
I need to provide the SQL statement with a start long/lat position.<br>
They then want to receive 34 images, going south from their initial<br>
long reference.. once they get to -90 (the bottom of the earth) to pop<br>
over 1 degree to the right/East and search up to the north to 90 and<br>
repeat until 34 images are found.<br>
<br>
What&#39;s confusing me is how to calculate the minus to plus changes..<br>
ensuring that we loop up and down along the earths &#39;long&#39; reference.<br>
<br>
Has anyone done this before..?<br>
I&#39;d LOVE to do it in a single query...<br>
<br>
Ok, back to google!!<br>
<br>
Thoughts...<br>
<br>
Tris...<br>
--<br>
<br>
<br>
==========================<br>
<br>
&quot;The only people who don&#39;t make mistakes are those who don&#39;t do anything&quot;<br>
<br>
Give a man a fish and he&#39;ll feed himself for a day.<br>
Give a man a religion and he&#39;ll starve to death praying for a fish.<br>
Anon<br>
<br>
`We are what we pretend to be, so we must be careful what we pretend to be.`<br>
Kurt Vonnegut<br>
<br>
`When a person can no longer laugh at himself, it is time for others<br>
to laugh at him.`<br>
Thomas Szasz<br>
_______________________________________________<br>
devtalk mailing list<br>
<a href="mailto:devtalk@lists.preshweb.co.uk">devtalk@lists.preshweb.co.uk</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/devtalk" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/devtalk</a><br>
</blockquote></div><br></div></div>