Find a longitude given a pair of (lat,long) and an offset latitude

1.7k views Asked by At

In a geodetic coordinate system (wgs84), i have a pair of (latitude,longitude) say (45,50) and (60,20). Also i am said that a new pair of latitude,longitude lies along the line joining these two and at an offset of say 0.1 deg lat from (45,50) i.e. (45.1, x). How do i find this new point? What i tried was to apply the straight line equation

y = mx+c
m = (lat1 - lat2)/ long1-long2)
c = lat1 - m * long1

but that seemed to give wrong results.

2

There are 2 answers

2
Support Ukraine On BEST ANSWER

Your problem is the calculation of m. You have turned it around!

The normal formula is:

a = (y1 - y2) / (x1 - x2)

so in your case it is:

m = (long2 -long1) / (lat1 - lat2)

so you'll get m = -2

And you also turned the calculation of c around.

Normal is:

b = y1 - a * x1

so you should do:

c = long1 - m * lat1

So you'll get c = 140.

The formula is:

long = -2 * lat + 140

Another way to think about it is given below. The result is the same, of cause.

The surface-line between two coordinates is not a straight line. It is a line drawn on the surface of a round object, i.e. earth. It will be a circle around the earth.

However all coordinates on that line will still go through a straight line.

That is because the coordinate represents the angles of a vector from center of earth to the point you are looking at. The two angles are compared to Equator (latitude) and compared to Greenwich (longitude).

So you need to setup a formula describing all coordinates for that line.

In your case the latitude goes from 45 to 60, i.e. increases by 15.

Your longitude goes from 50 to 20, i.e. decreses by 30.

So your formula will be:

(lat(t), long(t)) = (45, 50) + (15*t, -30*t) for t in [0:1]

Now you can calculate the value of t that will hit (45.1, x) and afterwards you can calculate x.

1
MisterC On

The equations you use describe a straight line in an 2D cartesian coordinate system.

Longitude and latitude describe a point in a spherical coordinate system. A spherical coordinate system is not cartesian.

A similar question was answered here.