On Jul 30, 10:15 am, Sebastian Sito <[email protected]> wrote: > Hello, > > I have many locations(latlng's) in my database and geoIP. I want to > show only these markers that are in for example 5 miles away from user > location discovered by geoIP?
There's a query in this post which does that: http://groups.google.com/group/Google-Maps-API/msg/44b2c049d1754189 $query = sprintf("SELECT address, name, lat, lng, (3959*acos(cos (radians('%s'))*cos(radians(lat))*cos(radians(lng)-radians('%s'))+ sin(radians('%s'))*sin(radians(lat)))) AS distance FROM markers HAVING distance < '%s' ORDER BY distance LIMIT 0, 20", mysql_real_escape_string($center_lat), mysql_real_escape_string($center_lng), mysql_real_escape_string($center_lat), mysql_real_escape_string($radius)); The LIMIT 0, 20 means you only get 20 rows. Remove that in order to retrieve all rows within $radius of the $center_ coordinates. Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" 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 -~----------~----~----~----~------~----~------~--~---
