Sign in to follow this  

Calculate New Lat\Lon

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to come up with a routine that when given a lat/lon coordinate, Heading and distance calculates the new lat/lon coordinate. Does that make sense? So if I am at lat/lon coordinate "x" and I want to go 50 meters at a heading of 43 degrees what will be my final lat/lon coordinate "z"? Does anyone have any ideas for me? Thanks in advance!!!!

Share this post


Link to post
Share on other sites
let THETA and PHI describe the longitude and latitude.

-----------------------------------------------------------------------
Note: PHI = 0 describes the equator. Hence PHI represents the
lines of latitude. THETA represents the line of longitude.
-----------------------------------------------------------------------

1) If a guy runs directly north (or south) at a speed, v, then NO MATTER where he is
in the world the change in latitude, PHI is given by

d_PHI / d_t = v / r

2) If the guy runs from east to west, at a speed, u, then the change in THETA is given by

d_THETA / d_t = speed / r / cos(PHI)

where r is the radius of the earth.

3) Now given a direction, say from the north pole, ALPHA,
where ALPHA = 0 points towards the north pole and
ALPHA = pi points towards the south pole, then

u = speed * sin(ALPHA)
v = speed * cos(ALPHA)

4) Beware at the poles ALPHA is "meaningless", you have a singularity

Share this post


Link to post
Share on other sites
This is not a simple problem, but it can be solved if you realize that there are two cases:

Case 1 - Short Distances:

Over short distances the Earth can be considered a plane and the distance between lines of latitude are constant. To make this easier, degrees east longitude and degrees south latitude are being considered negative degrees west longitude and north latitude respectively.

So if we are at the Equator and wish to travel theta degrees east of North we can solve as follows (at the Equator):

long_new = long_old + (d*cos(theta+90))/60 [assuming d is in nautical miles]
lat_new = lat_old + (d*sin(theta+90))/60 [assuming d is in nautical miles]

There is a scaling factor (S) of latitude (in degrees)/90 degrees that needs to be introduced into the longitude equation because the longitude lines converge at the poles... so the generalized short distance formulas are:

long_new = long_old + (d*cos(theta+90))/(60*S) [assuming d is in nautical miles]
lat_new = lat_old + (d*sin(theta+90))/60 [assuming d is in nautical miles]

Case 2 - Long Distances:

Over long distances we run into the problem that the Earth is in fact a sphere. This problem then becomes significantly more difficult. Now we are trying to find the endpoint of the curve with an arclength of d nautical miles, an initial position of (Re,longitude,latitude) in spherical coordinates and an initial direction of (x,y,z) in cartesian coordinates and this curve is known to stay on the surface of the sphere with radius = Re.

So, we can set this up as d = integral(integral(sqrt(Re^2-x^2-y^2)dydx,dx,x0,x1),dy,y0,y1) and solve for x1 and y1 which I have no idea how to do.

Edit: Fixed the sin and cos so that they actually came out to numbers that somewhat represented what direction you were going, rather than pointing in all sorts of weird directions.

[Edited by - jperalta on May 17, 2005 5:43:14 AM]

Share this post


Link to post
Share on other sites
Just realised that if you keep on the same heading (i.e. alpha = constant) then you will SPIRAL towards the north/south pole. Hence, to undertake a "straight" arc around the world then alpha must vary sinusoidally. I have no idea at the moment on how to calculate that but will look into it.

Share this post


Link to post
Share on other sites
Another useful formula that might help to solve the general large-scale problem is the great circle formula. d = a*arccos(cos(delta1)cos(delta2)cos(lambda1-lambda2)+sin(delta1)sin(delta2)) where d = the distance you travelled, delta is latitude and lambda is longitude. This equation will be very helpful if you can find another equation for something similar, most likely in terms of heading, delta and lambda because then you will have two equations with only two unknowns and you can solve it as a system of equations.

Share this post


Link to post
Share on other sites

This topic is 4596 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this