Solved

Posted on 2006-05-02

How can i calculate the angle between 2 vectors lat long?

x: lat, long

a: -95.77071229704562,34.9343240443434

b: -95.76835645203101,34.9339768366878

c: -95.774587384548,34.9259077248493

vector A is ba

vector B is bc

I have the distance in km of both vectors

A 0.218 km

B 1.062 km

thanks

Richard

x: lat, long

a: -95.77071229704562,34.9343

b: -95.76835645203101,34.9339

c: -95.774587384548,34.925907

vector A is ba

vector B is bc

I have the distance in km of both vectors

A 0.218 km

B 1.062 km

thanks

Richard

9 Comments

A.B = Ax * Bx + Ay * By

You have the lat and long of the points so you can calculate Ax, Ay, Bx, By by subtracting the lats and longs of the corresponding points (assume A and B are v1 and v2).

So you have the way to calculate v1.v2

You have the magnitudes of v1 and v2 which are 0.218 km and 1.062 km

So by multiplying them you have |v1||v2|

And that's all you need.

b -95.768356 34.933977

c -95.774587 34.925908

Subtract the b coordinates to redefine the origin:

a' -0.002356 0.000347 171.62 deg use atan2(long, lat) to find the heading

b' 0.000000 0.000000

c' -0.006231 -0.008069 232.32 deg

60.71 deg the difference between the headings.

All this is a planar approximation to a sphere,

which should be okay considering the small distances involved.

The difference between lats of the two points for A is (-95.77071229704562 - (-95.76835645203101))

The diff between longs of the two points for A is (34.9343240443434 - 34.9339768366878)

If these two values are named x and y, you can calculate the hypotenuse as sqrt(x*x+y*y)

Let's name this value z

Let X is the corresponding value for x in km

So you have X/x = 0.218/z

you already know x and y, thus you find the X

http://www.euclideanspace.

As you move north or south, deg lat stay the same, but deg long shrink by cos(lat)

So it is not correct to treat the long and lat coordinates as distances.

a -95.770712 34.934324

b -95.768356 34.933977

c -95.774587 34.925908

a' -0.002356 0.000347

b' 0.000000 0.000000

c' -0.006231 -0.008069

Correcting for the latitude:

a" -0.001932 0.000347 169.82 deg

b" 0.000000 0.000000

c" -0.005109 -0.008069 237.66 deg

--------------------------

67.84 deg

please view question http://www.experts-exchang

Thanks

Richard

Title | # Comments | Views | Activity |
---|---|---|---|

Baseline sigma | 8 | 22 | |

Michel Meyer experiments | 40 | 194 | |

Loan to Value to interest rate relationship formula | 1 | 123 | |

Probability Distribution | 5 | 29 |

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**14** Experts available now in Live!