# Find point given lati/long offset, heading and distance

• Jul 20th 2010, 05:42 AM
suntzu2007
Find point given lati/long offset, heading and distance
Hi all,

Given a start point (in latitude/longitude), initial heading (0 - 360 degrees), and distance (in meters), I am trying to find a second point, B. I've tried several solutions, amongst the closest being:
Code:

```lat = asin(sin(lat1)*cos(distance)+cos(lat1)*sin(distance)*cos(heading)) IF (cos(lat)=0)     lon=lon1    ELSE     lon=(lon1-asin(sin(heading)*sin(distance)/cos(lat))+pi % (2*pi))-pi ENDIF```
(obtained from Aviation Formulary V1.45)

The above didn't work, returning a wrong co-ordinate (e.g. if point B is due north, it would appear NW or NE etc)

After googling extensively, I managed to piece together the following (again without avail):
Code:

``` heading = toRadians(heading);         lat = toRadians(lat);         lon =toRadians(lon);         angularDistance = distance / WGS84_EARTH_RADIUS;         newLat = asin(                 sin(lat) * cos(angularDistance)                 + cos(lat) * sin(angularDistance) * cos(heading));         dlon = atan2(                 sin(bearing) * sin(angularDistance) * cos(lat),                 cos(angularDistance) - sin(lat) * sin(newLat));         newLong = ((lon + dlon + PI) % (PI * 2)) - PI;```
I'm sure that the problem is a simple one, however given how long it has been since I last did geometry....
Any suggestions?

• Jul 22nd 2010, 04:56 AM
suntzu2007
Anybody? :s
• Jul 22nd 2010, 06:59 AM
bjhopper
Hi suntzu,
Why don't you give lat and long + distance in km and heading.

bjh
• Jul 22nd 2010, 07:05 AM
suntzu2007
Hi bjh,

Sorry, I'm confused. Could you clarify what you meant by "Why don't you give lat and long + distance in km and heading."? Do you mean why I don't give the distance in KM? The heading is an angular measurement, so I can only give that in 0 - 360 degrees...sorry, I don't quite understand what you meant by this...
• Jul 22nd 2010, 09:23 AM
bjhopper
Hi suntzu,

Latitude = ? Longitude =? Heading like 60 degrees true=? Distance traveled in km or m =?

Unconfused ?

bjh
• Jul 22nd 2010, 10:30 AM
suntzu2007
I probably sound very stupid now, but: you want me to post a sample result?

Much more confused...sorry :(
• Jul 23rd 2010, 09:40 AM
bjhopper
Hi again suntzu,
If you are looking for a general equation in spherical trigonometry I think you are in the wrong forum.There is another method using a Mercator Chart for a limited area on which you would plot a straight line from P to Q at a designated heading and distance and quickly determine a new lat ,long position

bjh