Hiya, Sorry, I was a bit brain fried when I wrote this from all of the digging around and should have explained more.
> It's wrong, you have all fixed numbers in your formula. Whatever the > value of data in your table the formula will always evaluate to > exactly the same value. If that is more than 5, no rows will ever be > selected. It's not all hardcoded. I'm gathering my bits via php then just outputed the SQL it was trying to execute which is why the values appear to be hardcoded. OK, fresh mind, let me start again :) code suburb state lat long 3065 Fitzroy Victoria -37.7833 144.9833 3066 Collingwood Victoria -37.8000 144.9833 3067 Abbotsford Victoria -37.8044 144.9997 1. user enters a postcode into the form (3065). 2. PHP does a select to get lat (-37.7833) and long (144.9833) -- That's where the hardcoded values were generated (as per the lat, lon vars in Google's example). 3. This is where I'm stuck because Google hard codes the -37's and 144's respectively. Comparing their's and my data, I gathered a close match to mine was those two integers. So where I stand now is: SELECT *, ( 6371 * acos( cos( radians(-37) ) * cos( radians( -37.7833 ) ) * cos( radians( 144.9833 ) - radians(144) ) + sin( radians(-37) ) * sin( radians( -37.7833 ) ) ) ) AS distance FROM Geocode_AU HAVING distance < 5 ORDER BY distance > where 37 is the "target" longitude for the centre of the search > Also why I don't understand is why they rounded some of the lattitudes and This is where I'm stuck. So, I need to first calculate and replace the integers and replace the -37 and 144. It's not clear to me how to do this because I thought the search area within the table was controlled via the HAVING caluse? The example on that link doesn't explain why they've hardcoded those numbers. That's why I've got 'HAVING distance < 5' as I thought this is what determined the 5 kilometer radius (notice I'm using 6371 for kilometers). Google's example just states "are within a radius of 25 miles to the 37, -122 coordinate" and their example has 'HAVING distance < 25'. > You could take it as a clue that your implementation, which isn't the > same as Google's example, could be wrong? I copied and pasted exactly what Google documented and it still didn't work hence my confusion. I created the table and populated it all via the SQL prompt so it should have worked. Sorry I wasn't as clear as I could have been. Er, any ideas? I just need to figure out what those hardcoded coordinates. I thought on a whim that I'd replace the -37 with -37.7833 and 144 with 144.9833 but no luck :( Cheers, J -- You received this message because you are subscribed to the Google Groups "Google Maps API V2" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
