Just another WordPress.com site

WGS84 Ellipsoid Calculations

(source code links below)
12/7/2010, added support for building as a DLL and using within Microsoft Excel VBA.

In late 2008, I was in negotiations with an aviation company to write some navigation design software. I use to work for the company and was already familiar with their software stacks and engineering processes. Quite a few of the applications the company uses, I had written or helped implement. The chances of actually getting the contract were slim though. Internal growth of the company was fast, and different departments were motivated to go a different direction than the department I was in talks with.

Even though the chances of getting the contract were slim, I wanted to get a jump on some crucial code that would be required from the onset. So I set out on October 15, 2008, to write all the formulas described in FAA Order 8260.54A, Appendix 2, and a test harness for the data published in attachment C of the same document.

Initially I figured it would take 2 to 4 weeks to write the library and test harness based on the completeness of 8260.54A. Almost immediately, I discovered the document to have many errors and omissions, which caused days long investigations into why the formulas didn’t produce the expected test results (the projects code, comments and file Application test Results.txt document some of the problems and how they are resolved).

On December 18, 2008, I finished the work, had no contract, but was proud that I’d resolved each and every formula in Appendix 2 and they produced the expected test results. Now, a year and a half later, I’m releasing the code for the formulas and test harness.

I wrote a standalone WGS84 Geodesic Calculator (beta) for Windows based on the formulas, and some people from the GeoCache community have used it to create and solve complicated puzzles.

The hardest part about releasing the code was which license to choose. Ultimately I decided for the liberal Apache License, Version 2.0, and it’s my contribution to the open source community.

WGS84 Ellipsoid Calculation Types

Arc Intercept Geodesic Locus Intersect Point on LocusP
Course Intersect Geometric Mean Meridional Point to Arc Tangents
Direct Arc Length Locus Arc Intersect Pt is on Arc
Discretized Arc Length Locus Course at Point Pt is on Geodesic
Distance Intersection Locus Intersect Pt is on Locus
Distance to LocusP Locus Perpendicular Intercept Tangent Fixed Radius Arc
Distance to LocusD Locus Tangent Fixed Radius Arc Vincenty Direct
ECEF Perpendicular Intercept Vincenty Inverse
Geodesic Arc Intercept Perpendicular Tangent Points

There are a few other implemented formulas which are support to the ones listed above.  Also, the TerpsTest code for validating the formulas is a good source to see how to use the formulas in your own code.

Available Source Code

The GeoFormulas and TerpsTest (test harness) code is hosted on GitHub, and released under the Apache License, Version 2.0. Note: TerpsTest requires Boost::RegEx. Outside of STL, GeoFormulas is not dependent on external libraries.

The source code for the standalone Windows WGS84 Geodesic Calculator is not available at this time.


July 14, 2010 - Posted by | Ellipsoid, FAA, WGS84 | , , , , , , , ,


  1. Hi Paul,

    Very usefull. I am implementing a plugin for OpenCPN, and making good use of some of your code. I like the way you have set-up the tests!!!

    Comment by SaltyPaws | July 29, 2012 | Reply

    • Thanks SaltyPaws. I’ve recently started a new project using the codebase and have removed all Boost Library dependencies. The code isn’t released yet, but if you are interested send an email.

      Comment by Paul | August 2, 2012 | Reply

  2. Hi Paul, Another question, have you considered submitting this as a boost library? You allready fullfill the boost testing requirements. I understand boost is quite a good library to have on your CV.

    Comment by SaltyPaws | August 2, 2012 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: