The distance formula from any point on a flat plain is pretty
straightforward.  If you get very far away, you now need to step into
spherical trigonometry (and that was no longer a required subject even
when I went to high school.)

For a flat plain, the distance between 2 objects is the simple
triangle hypotenuse theorem.

distance = square root ( (x2 - x1) squared + (y2-y1) squared ))

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.

On Sep 20, 5:23 am, TS <[email protected]> wrote:
> Hi,
> in a database I have stored several addresses including their
> geocoding data. Now I need to write a function where the user can set
> a start point and a distance (radius) and the result should show every
> address which is within this circle.
>
> I need to do all the calculation server side and then sent the
> relevant addresses to the client to finally ad the markers to the map.
>
> By calling the Geocoder I get the lat/lng for the start point but
> don't know how to do math for the circle. I would need to check every
> address from the db whether it is in the area of the given circle or
> not by looping.
>
> Is this possible? Any help appreciated!

-- 
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.

Reply via email to