Tag Archive: Calculations

Great Circle calculated and plotted

I wrote a program, two programs actually, one in Mathcad and another in Excel, which calculate the parameters of a Great Circle defined by any two points. The programs also calculate the bearing angle of the second location, as seen by the first location; and they also calculate the distance between the two locations, along the arc of the Great Circle.

Permanent link to this article: https://w7buf.com/2011/08/14/link_to_great_circle/

Calculating Great Circle Distances and the Bearing Angle

The new webpage showing the details and equations and calculations of the distance along a Great Circle is


I will begin working on the web page for showing the calculations of the Bearing Angle. I have the Mathcad file ready but converting the Mathcad work to web page html does take quite a bit of time just to do all the
formatting. Every single equation is an image file needing coding and placing on the page. It may be a week – Oct 18 or so – before I get that webpage html-ready and uploaded.

I’ve done some thinking and calculating about both the bearing angle and the distances given in QRZ’s “detail” page for Ham operators. I worked out ways to get both the distance and bearing angle using vector methods and will outline my methods below. If you want more details or have questions, please contact me by writing a comment or emailing me at tango_gal@w7buf.com

I saw a way to get the distance as soon as I started thinking about Great Circles connecting two locations. The bearing angle, though, took me a lot longer to figure out how to calculate. It shouldn’t have, really, because I had all the pieces and all the math I needed right in front of me. I finally got it today, after just sitting with it and thinking through what needed to be done. There are lots of webpages where these kinds of calculations can be done for you, but I enjoy working out things like this on my own, if I can. I’m pretty good with vector mathematics so I enjoyed this challenge. I know that for some people, math is like death itself.

Here is an overview of the methods I used for my calculations. I wrote out the position vectors from the Earth’s center pointing to the two locations. First these were in polar spherical coordinates. I defined things as follows: the XY plane is the Earth’s Equatorial plane. The X axis is the GMT meridian. The angle theta is equal to the longitude of the location of interest because longitude is measured from the GMT meridian. East Longitudes are positive angles and West longitudes are negative angles. In Polar Spherical coordinates, the three coordinates are R = Radius of Earth in this case; Theta as described; and another angle (PHI) is measured from the Z axis, which coincides with the North end of the Earth’s axis of rotation. Since latitudes are measured from the Equator, PHI = 90 – Latitude. ((North latitudes are positive, giving values of PHI between 0 and 90. South latitudes are negative, so 90 – latitude gives a result greater than 90.

Next I converted the polar spherical cooordinates of the two locations, into x,y,z rectangular coordinates so I could take their dot product and use that to get the angle between those two position vectors. The dot product of two vectors gives the cosine of the angle between them and mulitplied by the magnitudes of the two vectors. Our vectors magnitude are each = the radius of the Earh. So divide the dot product by R squared and take the arc-cosine of the result. That will give the angle between the two position vectors. Multiplying that angle by the Radius of the Earth give me the distance from one point to the other along a Great Circle arc. Care must be taken during all of these steps that the trig functions are all calculated using the same angle mode, either all radians (recommended) or else all in degrees. If you use degrees you must convert that final angle between the two position vectors into radians before multipyling it by the Radius of the Earth to get the distance between the locations along the Great Circle arc. That’s the distance QRZ gives in it’s “detail” page when you look up someone’s call sign.

I’m sure there’s a more elegant way to get the bearing angle than what I finally came up with, but that’s okay, I’m probably not actually going to use these equations for anything else. And I set them all up in Mathcad so if I do want to use them all I would have to do is plug in the latitude and longitude of new locations and Mathcad will give me the results.

Using the same vector methods I’ve used for calculating the six elements of elliptical orbits, I calculated both the inclination and the ascending node of the Great Circle. My example points were my home location and that location in Indianna I mentioned before. The ascending node is the longitude at which the Great Circle intersects the equator while entering the Northern hemisphere. (Picture something traveling North-Easterly along the Great Circle). The inclination is the angle the plane of the Great Circle makes with the equator at that intersection point. To calculate the incination angle, we first find a vector perpendicular to the plane of the Great Circle. Let’s call it vector C. Simply take the cross product of the two position vectors. That gives vector C, which is a vector perpendicular to both of the positions and perpendicular to the GC plane. Because of that, the angle this new vector makes with the Z axis is precisely the angle at which the plane of the GC makes is tilted from the Equatorial plane. If the Great Circle was an orbit we would call this angle the inclination of the orbit. To get the inclination angle, take the dot product of the new vector (C) with a unit vector along the Z axis; ie (0,0,1). Since the dot product gives the cosine of the angle between the vectors mulitplied by the magnitudes of the two vectors, we divide this result by the Earth’s radius and take the arc-cosine. This will then be the inclination angle. Pay attention to the angle mode of the calculator you are using. You need to know whether your angle is coming out in radians or in degrees.

To get the location where the Great Circle intersects the Equator, (which for orbits is called the longitude of the ascending node, OMEGA), calculate the cross product of vector C with the unit Z axis vecor. This gives a vector “D” perpendicular to the Z axis and which lies in the plane of the Great Circle (in other words perpendicular to both vectors which were crossed to get it). Vector D is the line of intersection of the plane of the Great Circle and the Equatorial plane. The longitude of the ascending node is measured along the Equator, from the X axis (at the GMT),
to this vector D. It can be calculated by taking either the dot or cross product of Vector D with a unit vector along the X axis ie; (1, 0 , 0) and then dividing by Earth’s radius again, and taking the arc-cosine or arcsine depending on whether dot or cross product was used.

The next part got wild and crazy. All I wanted was a vector tangent to the Great Circle at my home location so I could find it’s direction relative to North. That’s the “initial bearing” which is what QRZ gives on it’s “detail” page. I used my first formula again to calculate the angular sweep from the ascending node to my home location along the Great Circle. Let’s call this angle ALPHA. (Dot product of vector D with my home position vector then divide by R and arc-cosine). Then I wrote a position vector for a point along the circle which is the same angular distance as my home position is from the ascending node. Basically X = R * cosine(ALPHA) and Y = R * sine(ALPHA) and Z = 0.

If you’re not dizzy yet you will be in a moment. At that location I wrote a vector tangent to the Great Circle. (simply add 90 degrees to ALPHA in the previous vector formulas: Xtangent = R * cos(ALPHA + 90); Ytangent = R * sin(ALPHA + 90) and Z = still zero. I’m saying “90” but if you are using radians you must use 1.573 instead of 90.

Now comes the tricky part. WE need to rotate this XY plane around two axes so that it ends up being the plane of the Great Circle. This is done using rotation matrices. The first rotation is around the Z axis, by an amount OMEGA degrees (or radians). That rotation brings the X axis to where the great circle intersects the Equator. The second rotation is around the (new) X axis, by an amount = the inclination of the Great Circle). After these two rotations, the Great Circle has the inclination and ascending node location it is supposed to have. Those rotations transformed that vector which was tangent to the circle into what it’s coordinates look like in the Earth’s Latitude Longitude coordinate system. Since the tangent vector we wrote was located ALPHA degrees along the Great Circle, it should now be located right at my home position. Check to make sure that the tangent vector, after those two coordinate system rotations, is perpendicular to the home location position vector. Take their dot product and it should give zero. To get the bearing angle which all of this was for, I still needed another vector. I needed one which was tangent to the Earth’s surface at my home location but pointing in a Northerly direction (along a line of constant longitude). The key to writing that one was realize that vector would be perpendicular to my home location position vector. If my home position latitude is 30 degrees North, then the tangent vector would be at an angle of 90 + 30 from the Z axis. That enabled me to write it. Call it vector E. The last step was to take the cross product of E with the vector tangent to the Great Circle. Dividing this result by R again, and taking the arcsine gives the bearing angle.

I wish I could provide nice diagrams for all this but I don’t have a way to do that. What I can do is show the particular Great Circle I was working with, from the place where it intersects the equator, to where it passes through my home location and then goes to that location of the ham in Indianna. The Great Circle crosses the Equator pretty near to that bit of land in the very bottom left corner. That bit of land is the NorthEastern “corner” of Papa New Guinea, which has the village of Kavieng on Latangia Island.

Map showing Great Circle from ascending node at the equator to Eugene and on to Indianna

Map showing Great Circle from ascending node at the equator to Eugene and on to Indianna

What Visitors Like

Permanent link to this article: https://w7buf.com/2011/07/25/more_on_distances_and_bearing_angles/