Hi, thanks for the answers so far! Meanwhile my problem is not to calculate the radius of the given addresses in the database anymore. I would do this by using Pythagoras: a2 + b2 =c2. The problem I still have is that the client sets the radius in meter and for any calc and the following comparison with MySQL I need to convert either the distance in meters to lat/lng or lat/lng to meters.
On 21 Sep., 04:58, cwb <[email protected]> wrote: > As I said, if you talk "long distances", the earth is not a "plain" > field. If you'd rather have him use Haversines formula, why not quote > it here. Otherwise, for distances under a few hundred miles (other > than at Latitude 90 or -90) my formula should work (assume latitude is > "y" and longitude is "x"). > > On Sep 20, 7:59 pm, Rossko <[email protected]> wrote: > > > > distance = square root ( (x2 - x1) squared + (y2-y1) squared )) > > > Sure, but that doesn't work well for lat/long coordinates. Haversine > > Formula is generally used. > > > > Note that you need to do this arithmetic for every point that's within > > > the square (lowest x, lowest y) to (highest x, highest y), but you can > > > do this query in SQL and then eliminate the ones outside the circle. > > > Yes, if searching a large database a simple "bounding box" query can > > be used to give candidates for more complicated further testing. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
