Stack Overflow Questions Tags Users Badges Unanswered Ask Question Calculate second point knowing the starting point and distance

Posted: August 21, 2011 in Android, Java, Mapping

using a Latitude and Longitude value (Point A), I am trying to calculate another Point B, X meters away bearing 0 radians from point A. Then display the point B Latitude and Longitude values.

Example (Pseudo code):

PointA_Lat = x.xxxx; PointA_Lng = x.xxxx; Distance = 3; //Meters bearing = 0; //radians new_PointB = PointA-Distance; 

I was able to calculate the distance between two Points but what I want to find is the second point knowing the distance and bearing.

Preferably in PHP or Javascript.

Thank you

 

4 down vote accepted

It seems you are measuring distance (R) in meters, and bearing (theta) counterclockwise from due east. And for your purposes (hundereds of meters), plane geometry should be accurate enough. In that case,

dx = R*cos(theta) ; theta measured counterclockwise from due east dy = R*sin(theta) ; dx, dy same units as R 

If theta is measured clockwise from due north (for example, compass bearings), the calculation for dx and dy is slightly different:

dx = R*sin(theta) ; theta measured clockwise from due north dy = R*cos(theta) ; dx, dy same units as R 

In either case, the change in degrees longitude and latitude is:

delta-longitude = dx/(111320*cos(latitude)) ; dx, dy in meters delta-latitude = dy/110540 ; result in degrees long/lat 

The difference between the constants 110540 and 111320 is due to the earth’s oblateness (polar and equatorial circumferences are different).

Here’s a worked example, using the parameters from a later question of yours:

Given a start location at longitude -87.62788 degrees, latitude 41.88592 degrees, find the coordinates of the point 500 meters northwest from the start location.

If we’re measuring angles counterclockwise from due east, “northwest” corresponds to theta=135 degrees. R is 500 meters.

dx = R*cos(theta) = 500 * cos(135 deg) = -353.55 meters dy = R*sin(theta) = 500 * sin(135 deg) = +353.55 meters delta_longitude = dx/(111320*cos(latitude)) = -353.55/(111320*cos(41.88592 deg)) = -.004266 deg (approx -15.36 arcsec) delta-latitude = dy/110540 = 353.55/110540 = .003198 deg (approx 11.51 arcsec) Final longitude = start_longitude + delta_longitude = -87.62788 - .004266 = -87.632146 Final latitude = start_latitude + delta_latitude = 41.88592 + .003198 = 41.889118 



Reference:

http://stackoverflow.com/questions/2187657/calculate-second-point-knowing-the-starting-point-and-distance

Advertisements
Comments
  1. Greetings from Florida! I’m bored at work so I decided to browse your site on my
    iphone during lunch break. I enjoy the information you provide here
    and can’t wait to take a look when I get home. I’m shocked at how fast your blog loaded on my cell phone ..

    I’m not even using WIFI, just 3G .. Anyways, great blog!

  2. Hi, itѕ good post сoncerning media print, we all
    understand media iѕ a fantastic source օf information.

  3. Build yoyr web presence becomes stronger, which in turn will boost the
    popularity of yolur online business to be abc found by other readers.
    It’s a technique used to help get your website on a
    mobile phone or by search engines and attract the right visitors to your Facebook Page!In most cases, this
    will not be shared with the website. Therefore, there are a
    few things about marketing and communication. Thiss abc is the foundation upon which everything else is going to other websites.

  4. Edrech.co.uk says:

    I’m not sure why but this website is loading incredibly slow for me.

    Is anyone else having this issue or is it a issue on my end?
    I’ll check back later on and see if the problem still
    exists.

  5. Woah! I’m really loving the template/theme of this blog.
    It’s simple, yet effective. A lot of times it’s tough to
    get that “perfect balance” between superb usability and
    visual appeal. I must say you’ve done a awesome job with this.
    In addition, the blog loads super quick for me on Firefox.
    Exceptional Blog!

  6. Hello to all, the contents existing at this web site are actually amazing for people experience, well, keep up the good work fellows.

  7. Tamie says:

    I used to bbe recommended thiis web siute via my cousin. I am now not certain whether this
    submit is written by him as nobody else understand such distinct approximately my
    difficulty. You are amazing!Thank you!

  8. fibromialgia says:

    Yes! Finally sοmetҺіng about dolor diseminadߋ.

  9. Alաays happy and at ɑll times smiling.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s