Question : Calculating a bearing line from two points

I have two points P0 at lat/long 34.1837710,-118.9484950 and P2 at 34.1769790,-118.9168300.

According to the link here (http://www.movable-type.co.uk/scripts/latlong.html), the formula for calculating a bearing line in Excel is below (and I filled in all the values in the code below):
ATAN2(COS(lat1)*SIN(lat2)-SIN(lat1)*COS(lat2)*COS(lon2-lon1), SIN(lon2-lon1)*COS(lat2))

In ExceI I got -1.803351018 radians which I then converted to decimal degrees by doing this:
(180/PI())*-1.803351018

The result was -103.3244023 degrees but the author of the article gets 104° 31' 36" which is 104.52667 decimal degrees.

* So which bearing line is correct? *

PS.  Given the choice, I'd like a formula for a Rhumb line, not a Great Circle bearing line.

PPS. Code for doing it in PHP instead of Excel is at http://www.dougv.com/blog/2009/07/13/calculating-the-bearing-and-compass-rose-direction-between-two-latitude-longitude-coordinates-in-php/
Code Snippet:
1:
2:
3:
//Filled in values for Excel.
//Just cut and paste to test
ATAN2(COS(34.183771)*SIN(34.176979)-SIN(34.183771)*COS(34.176979)*COS(-118.91683--118.948495), SIN(-118.91683--118.948495)*COS(34.176979))

Answer : Calculating a bearing line from two points

From the formula you wrote:

Assuming lat is column b, and lon is column c
and row 2 is point 0
and row 3 is point 2

=DEGREES(ATAN2(COS(RADIANS(B2))*SIN(RADIANS(B3))-SIN(RADIANS(B2))*COS(RADIANS(B3))*COS(RADIANS(C3-C2)),SIN(RADIANS(C3-C2))*COS(RADIANS(B3))))

this yielded104.5267 decimal degrees for the number of decimals I was displaying.  I also was using excel 2003 to test.
Random Solutions  
 
programming4us programming4us