Spherical Geometry and Vincenty’s Formulae

Wikipedia has detailed articles on:
Spherical Geometry  and
Vincenty’s Formulae (for geometric calculations on an ellipsoid).

The spreadsheet Vincenty.xlsb uses those resources to perform the following calculations, using both on-sheet calculations and VBA user-defined functions (UDF’s):

  1. Calculation of distance and azimuth angles given latitude and longitude for two points.
  2. Calculation of latitude and longitude and azimuth for a second point, given the position and azimuth for the first point.
  3. Calculation of the area inside a closed polygon, using the excess angle method.

The spreadsheet contains full open source code, and documentation for the on-sheet calculations.  Examples are shown in the screenshots below (click any image for full-size view):

Input  and  geometry constants required for the VincentyLen  Function:

The on-sheet calculation follows the procedure given in the Wikipedia article.  The VincentyLen function returns the same end results (in bold), and can also return the intermediate results:

The  VincentyCoord function solves the “Direct Problem”, returning the latitude and longitude for a point at a specified distance and bearing from another point:

The VincentyArea Function finds the area inside a polygon specified by the latitude and longitude for a series of points, listed in clockwise order, using the “Excess angle method”. Note that as well as the returning the area, if the optional second argument is set to 2 the function returns additional data for each segment of the polygon, as shown in columns H to L below:

The VincentyArea function has been used to calculate the area of the Australian mainland, using a series of 2900 points:

The data for the points is listed with longitude first then latitude.  All three functions have an optional third “XY” argument to deal with this convention with the values:

  • 1 (default) – Latitude then Longitude
  • 2 – Longitude, Latitude
This entry was posted in Computing - general, Coordinate Geometry, Excel, Maths, Newton, UDFs, VBA and tagged , , , , , , . Bookmark the permalink.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.