Okay, this is one we have done before over here. We have over 10,000 points in a database, but we only want to populate those that are within roughly 30 mile of a site. The way we do it is by adding a box around the coordinates. A circle is nice, but the maps don't come out in circles. If you want the mathematical analysis look up the wikipedia longitude to nautical miles discussion. A nautical mile = .0025 Degrees at the equator. So for basic distance you can simply do this //range of items in nautical miles $range = 30; //range in miles $range = $range * .0025; //should be .0145 Now add and subtract this to your longitude and latitude to get the range of coordinates. $lamax = $la + $range; //latitude maximum $lamin = $la - $range; //latitude minimum $lomax = $lo + $range; //latitude maximum $lomin = $lo - $range;//latitude minimum Finally run these as max and mins through your database to return all point sets that fall within the range.
Now there are a couple things to remember, A nautical mile is longer than a statute mile. This is not as accurate the further away from the equator you get. Easy and rough method for parsing points out of a database onto a map. Enjoy. Todd > > 25000 mile circumference of earth at the equator. Divide by 360 > degrees, and you get 69.44 miles per degree. > Solve for 1 mile > 1/69.5 =.014388 degrees not .0025 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
