How to calculate the latlng of a point a certain distance away from another?

Posted by Rene Saarsoo on Stack Overflow See other posts from Stack Overflow or by Rene Saarsoo
Published on 2010-04-14T11:44:52Z Indexed on 2010/04/14 16:03 UTC
Read the original article Hit count: 190

Filed under:
|

To draw a circle on map I have a center GLatLng (A) and a radius (r) in meters.

Here's a diagram:

           -----------
        --/           \--
      -/                 \-
     /                     \
    /                       \
   /                   r     \
   |            *-------------*
   \             A           / B
    \                       /
     \                     /
      -\                 /-
        --\           /--
           -----------

How to calculate the GLatLng at position B? Assuming that r is parallel to the equator.

Getting the radius when A and B is given is trivial using the GLatLng.distanceFrom() method - but doing it the other way around not so. Seems that I need to do some heavier math.

© Stack Overflow or respective owner

Related posts about google-maps

Related posts about JavaScript