in reply to Re^2: Calculate bearing between GPS coordinates
in thread Calculate bearing between GPS coordinates

This is largely academic due to the short distances involved, but... If you follow a constant compass bearing, you're not on a great circle path, you're following a rhumb line. For your Calgary-to-Toronto example, the great circle starts off at a bearing of 94 deg, but you need to adjust that along the way, so when you get to the destination, you're headed at 120.5 deg. The rhumb line is a constant 107.8 degrees the entire way. The rhumb bearing is calculated as follows:
my $bearing = atan2($lon2 - $lon1, aths($lat2) - aths($lat1)); sub aths { # atanh(sin(x)) my ($x) = @_; my $y = sin($x); return 0.5*log((1 + $y) / (1 - $y)); }